Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Primefaces 为什么在指定x轴选项时y轴系列标签会更改?_Primefaces_Jqplot - Fatal编程技术网

Primefaces 为什么在指定x轴选项时y轴系列标签会更改?

Primefaces 为什么在指定x轴选项时y轴系列标签会更改?,primefaces,jqplot,Primefaces,Jqplot,我有一个由PrimeFaces生成的水平条形图,我扩展了该条形图以进一步控制配置: <h:inputHidden value="#{chartBean.chartHeight}" id="chartheight" /> <p:barChart id="chart" value="#{chartBean.chartModel}" orientation="horizontal" rendered="#{!empty chartBean.chartModel.series

我有一个由PrimeFaces生成的水平条形图,我扩展了该条形图以进一步控制配置:

<h:inputHidden value="#{chartBean.chartHeight}" id="chartheight" />

<p:barChart id="chart" value="#{chartBean.chartModel}" orientation="horizontal"
    rendered="#{!empty chartBean.chartModel.series}" 
    title="Grades For Department" min="0" max="5" extender="my_ext" />  

<script type="text/javascript">
    function my_ext() {
        var val=$("#chartheight").val();
        $("#chart").height(val);
        this.cfg.seriesDefaults = {
            renderer:$.jqplot.BarRenderer,
            pointLabels: {show: true},
            rendererOptions: {
                barWidth: 20,
                barPadding: 10,
                barDirection: 'horizontal'
            }
        },
        this.cfg.axes = {
            xaxis: {
                renderer: $.jqplot.LinearAxisRenderer,
                tickInterval: 1
            }
        };
    }
</script>

函数my_ext(){
var val=$(“#图表高度”).val();
$(“图表”)。高度(val);
this.cfg.seriesDefaults={
渲染器:$.jqplot.blunderer,
点标签:{show:true},
渲染器选项:{
条宽:20,
加糖量:10,
B方向:“水平”
}
},
this.cfg.axes={
xaxis:{
渲染器:$.jqplot.LinearAxisRenderer,
时间间隔:1
}
};
}
如果没有脚本中的'this.cfg.axes'部分,我的y轴系列标签将显示人名(如预期的那样)。但是,一旦我添加了这一部分,序列标签将改为递增的数字。为什么会这样?我需要做什么来指定x轴配置,同时保留原始标签

顺便说一句,当鼠标悬停在任何一个条上时,都会显示这个数字而不是名称——无论我使用哪个版本的脚本

非常感谢,,
Neil

经过更多的调查,我找到了解决方案,尽管我不确定这是否是PrimeFaces或jqplot的问题:自定义配置后,需要重新设置xaxis勾号

this.cfg.axes.yaxis.ticks = this.cfg.categories;

如果您选择this.cfg.axes.xaxis={},它将不使用yaxis。