primefaces barchart:在条形图上显示数据点

swa*_*aps 1 jqplot primefaces

如何在条形图中显示条形图上的数据点?

我不想使用数据提示或工具提示,只有当它们被鼠标悬停时才会突出显示数据点.

我想在条形图上始终显示数据点.

有没有正确的方法来获得它?

谢谢.

我想要这样

BarPoint上的DataPoint

以下是我的代码

<p:barChart id="barChartId" value="#{myBean.myModel}"             
        orientation="horizontal"             
        stacked="true" extender="ext" animate="true" shadow="false" />              
<h:outputScript>         
  function ext() {  
    this.cfg.highlighter = {
             useAxesFormatters: false,
             tooltipAxes: 'x'   
    };      
    this.cfg.legend = {
            show: true,
            location: 'ne',
            placement: 'outside'
    }; 
    this.cfg.seriesDefaults = {
            pointLabels : { show: true },
    };              
  }        
</h:outputScript>
Run Code Online (Sandbox Code Playgroud)

这里,荧光笔和图例工作正常,但点标签没有显示在栏上

Dan*_*iel 6

不确定它是否会起作用......

使用extender<p:barChart,就像这样:

<p:barChart value="#{myBean.myModel}" widgetVar="myBarChart" extender="my_ext"/>


<script type="text/javascript">
    function my_ext() {
        this.cfg.seriesDefaults = {
            renderer:$.jqplot.BarRenderer,
            pointLabels: {show: true}
        };
        this.cfg.stackSeries: true;
    }
</script>
Run Code Online (Sandbox Code Playgroud)

或这个

<script type="text/javascript">
    function my_ext() {
        this.cfg.seriesDefaults = {
            pointLabels: {show: true}
        };
        this.cfg.stackSeries: true;
    }
</script>
Run Code Online (Sandbox Code Playgroud)

另请参阅jqplot示例:条形图

  • 为了解决这个问题,我为pointLables"jqplot.pointLabels.min.js"添加了一个jar文件,现在它可以正常处理你的答案.你的答案对我有什么帮助.谢谢 (2认同)