AmCharts 折线图与轴断开连接
AmCharts Line chart disconnected from Axis
我的图表在创建时与我的 y 轴断开连接。我想知道是否有人遇到同样的问题?如您所见,我尝试使用轴偏移。没有解决问题。
AmCharts.ready(function () {
chart = new AmCharts.AmSerialChart();
chart.dataProvider = chartData;
chart.categoryField = "timestamp";
chart.startDuration = 0;
chart.pathToImages = "/design/javascripts/amcharts/images/";
chart.zoomOutButton = {
var valueAxis = new AmCharts.ValueAxis();
valueAxis.title = "{t}Impressions{/t}";
valueAxis.offset = -25;
valueAxis.stackType = "regular";
valueAxis.position = "left";
valueAxis.gridAlpha = 0.1;
valueAxis.axisAlpha = 0.2;
valueAxis.dashLength = 1;
chart.addValueAxis(valueAxis);
backgroundColor: '#000000',
backgroundAlpha: 0.15
};
请帮忙
将categoryAxis
对象的startOnAxis
属性设为true
chart.categoryAxis.startOnAxis = true;
http://docs.amcharts.com/javascriptcharts/CategoryAxis
编辑:
正如 martynasma 所建议的,您应该注意,如果您将 chart.categoryAxis.parseDates
设置为 true
,这将不起作用,除非您还将 chart.categoryAxis.equalSpacing
设置为 true
。正如关于 "startOnAxis" 属性:
的 amcharts CategoryAxis 文档所述
Specifies whether the graph should start on axis or not. In case you display columns, it is recommended to set this to false. If parseDates is set to true, startOnAxis will allways be false, unless equalSpacing is set to true.
我的图表在创建时与我的 y 轴断开连接。我想知道是否有人遇到同样的问题?如您所见,我尝试使用轴偏移。没有解决问题。
AmCharts.ready(function () {
chart = new AmCharts.AmSerialChart();
chart.dataProvider = chartData;
chart.categoryField = "timestamp";
chart.startDuration = 0;
chart.pathToImages = "/design/javascripts/amcharts/images/";
chart.zoomOutButton = {
var valueAxis = new AmCharts.ValueAxis();
valueAxis.title = "{t}Impressions{/t}";
valueAxis.offset = -25;
valueAxis.stackType = "regular";
valueAxis.position = "left";
valueAxis.gridAlpha = 0.1;
valueAxis.axisAlpha = 0.2;
valueAxis.dashLength = 1;
chart.addValueAxis(valueAxis);
backgroundColor: '#000000',
backgroundAlpha: 0.15
};
请帮忙
将categoryAxis
对象的startOnAxis
属性设为true
chart.categoryAxis.startOnAxis = true;
http://docs.amcharts.com/javascriptcharts/CategoryAxis
编辑:
正如 martynasma 所建议的,您应该注意,如果您将 chart.categoryAxis.parseDates
设置为 true
,这将不起作用,除非您还将 chart.categoryAxis.equalSpacing
设置为 true
。正如关于 "startOnAxis" 属性:
Specifies whether the graph should start on axis or not. In case you display columns, it is recommended to set this to false. If parseDates is set to true, startOnAxis will allways be false, unless equalSpacing is set to true.