Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/106.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
Javascript C3线图显示hh:mm:ss_Javascript_C3 - Fatal编程技术网

Javascript C3线图显示hh:mm:ss

Javascript C3线图显示hh:mm:ss,javascript,c3,Javascript,C3,这可能吗 我有一个lite图表,用于跟踪患者的入住时间。这一次可能会以01:10:45或00:45:00或类似的形式返回。我试着把它画在一张图表上,这样接待员就可以看到检查诊所需要多长时间 起初,我只是在几分钟内策划这件事,但有人告诉我这件事不会成功。我找不到关于这个的任何文档,我已经尝试了我能想到的一切 这就是我的代码的样子 waitAverage = [] for(looping through all my data here){ waitAverage.push(moment(dat

这可能吗

我有一个lite图表,用于跟踪患者的入住时间。这一次可能会以
01:10:45
00:45:00
或类似的形式返回。我试着把它画在一张图表上,这样接待员就可以看到检查诊所需要多长时间

起初,我只是在几分钟内策划这件事,但有人告诉我这件事不会成功。我找不到关于这个的任何文档,我已经尝试了我能想到的一切

这就是我的代码的样子

waitAverage = []
for(looping through all my data here){
  waitAverage.push(moment(data[i].AverageWaitTime, "hh:mm:ss").format('HH.mm.ss')); //I have also tried formatting it like HH:mm:ss. I thought maybe decimals would help 
 waitAverage.unshift(label)
}

 arrayHolder.push(waitAverage); 

 c3.generate({
            bindto: '.timeline',
            data: {
                columns: arrayHolder,
                axes: {
                    data1: 'x'
                }
            },
            axis: {
                y: {
                    label: { // ADD
                        text: text,
                        position: 'outer-middle'
                    }
                },
                x: {
                    type: 'category',
                    categories: hour //This does exist I just didn't include the variable here
                }
            }
        });

任何帮助都将不胜感激

对于任何需要答案的人,我都能找到答案

在axis中,您必须调用tick format函数并执行一些奇怪的舍入

            axis: {
                y: {
                    label: { // ADD
                        text: text,
                        position: 'outer-middle'
                    },
                    tick: {
                        format: function (d) { 
                            return app.moment(Math.round(d*100)/100, "hh.mm").format('H:mm');
                        }
                    }
                },
                x: {
                    type: 'category',
                    categories: hour
                }
            }

对于任何需要答案的人,我都能找到答案

在axis中,您必须调用tick format函数并执行一些奇怪的舍入

            axis: {
                y: {
                    label: { // ADD
                        text: text,
                        position: 'outer-middle'
                    },
                    tick: {
                        format: function (d) { 
                            return app.moment(Math.round(d*100)/100, "hh.mm").format('H:mm');
                        }
                    }
                },
                x: {
                    type: 'category',
                    categories: hour
                }
            }