Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.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
Java y轴多轴线形图上的时间格式_Java_Jsf_Primefaces_Charts - Fatal编程技术网

Java y轴多轴线形图上的时间格式

Java y轴多轴线形图上的时间格式,java,jsf,primefaces,charts,Java,Jsf,Primefaces,Charts,我想将图表y轴上的时间显示为HH:mm:ss时间格式。现在我用秒来表示数据 有可能吗?我用扩展器解决了我的问题: xhtml: <p:chart type="line" model="#{myBean.multiAxisChartModel}" style="width:800px;" extender="customFormatter" /> <script type="text/javascript"> function customFormatter() {

我想将图表y轴上的时间显示为HH:mm:ss时间格式。现在我用秒来表示数据


有可能吗?

我用扩展器解决了我的问题:

xhtml:

<p:chart type="line" model="#{myBean.multiAxisChartModel}" style="width:800px;" extender="customFormatter" />
<script type="text/javascript">
    function customFormatter() {
        this.cfg.axes.y2axis.tickOptions.formatter = function(format, value) {
            d = Number(value);
            var h = Math.floor(d / 3600);
            var m = Math.floor(d % 3600 / 60);
            var s = Math.floor(d % 3600 % 60);
            return (h.toString().length == 1 ? ("0" + h) : h) + ":" + (m.toString().length == 1 ? ("0" + m) : m) + ":" + (s.toString().length == 1 ? ("0" + s) : s);
        };
    }
</script>

SS为毫秒。。。但是,为什么不在将日期放入模型之前转换它呢?我有一个多轴图表,在x轴上显示月份(字符串),在y轴和y2轴上显示两个不同的值。(x,y)是条形图(x,y2)是折线图。图表系列需要一对数据(对象,长)
multiAxisChartModel.setExtender("customFormatter");