简体   繁体   English

是否有一个 canvasJS 图表的示例,其中图表上的每个点在 X 轴上都有一个刻度和 label?

[英]is there an example of a canvasJS graph where each point on a graph has a tick and label on the X axis?

I cannot seem to find an example where every single point in a set of data had its own tick and label on a graph.我似乎找不到一个例子,其中一组数据中的每个点都有自己的刻度和图表上的 label。 when I load in my data, CanvasJS gives me intervals as my x axis.当我加载我的数据时,CanvasJS 给我间隔作为我的 x 轴。 the actual points are placed inbetween these intervals.实际点位于这些间隔之间。 If i add more data, the intervals dont change.如果我添加更多数据,则间隔不会改变。 I am looking for an example of how to make it so each point is represented.我正在寻找如何制作它的示例,以便表示每个点。

I would also like the xaxis to look as identical to this formatting as possible我还希望 xaxis 看起来与这种格式尽可能相同在此处输入图像描述

I have read some documentation here but I am struggling to make it work for me.我在这里阅读了一些文档,但我正在努力让它为我工作。 My X axis values look like this: 119604384477647324 but are in Miliseconds.我的 X 轴值如下所示:119604384477647324 但以毫秒为单位。

any help would be appreciated.任何帮助,将不胜感激。 I have a presentation soon and I am hard stuck.我很快就会有一个演示文稿,但我很难坚持。 thank you!谢谢你!

Passing label instead of x-value in datapoint seems to work fine.在数据点中传递label而不是x 值似乎工作正常。

 var chart = new CanvasJS.Chart("chartContainer", { title: { text: "Custom Labels on X Axis " }, data: [{ type: "column", dataPoints: [ { y: 71, label: "cat 1"}, { y: 55, label: "cat 2"}, { y: 50, label: "cat 3"}, { y: 65, label: "cat 4"}, { y: 95, label: "cat 5"}, { y: 68, label: "cat 6"}, { y: 28, label: "cat 7"}, { y: 34, label: "cat 8"}, { y: 14, label: "cat 9"} ] }] }); chart.render();
 <script type="text/javascript" src="https://canvasjs.com/assets/script/canvasjs.min.js"></script> <div id="chartContainer" style="height: 300px; width: 100%;">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM