修改此 jsfiddle 以使用不同的数据类型

Modify this jsfiddle to work with diferent data type

我找到了这个 canvasJs 的 jsfiddle 来制作图表:

http://jsfiddle.net/canvasjs/bn029p1o/

我在使用 X 轴上的日期实现此功能时遇到问题。

在示例中它说:

x: new date(... 

但我想这样显示日期:“11-jun” 我尝试制作类似“11-jun”的字符串格式,但不适用于 'new date' 或没有 'new date'

如果您阅读了文档 http://canvasjs.com/docs/charts/basics-of-creating-html5-chart/labels-index-labels/ 你会发现你必须更新图表配置并添加一个

axisX: { valueFormatString: "DD-MMM" }

实现所需的格式。

var chart = new CanvasJS.Chart("chartContainer", {
  title: {
    text: "MultiSeries Chart from JSON"
  },
  toolTip: {
    animationEnabled: true,
    shared: true
  },
  data: dataSeries,
  // This is what you need to add:
  axisX: {
    valueFormatString: "DD-MMM" 
  }
});

更新后的 fiddle 在这里(看起来很奇怪,因为你的数据都是同一天的):http://jsfiddle.net/62t2fxjh/