AmCharts折线图与Axis断开连接 [英] AmCharts Line chart disconnected from Axis
问题描述
创建时,我的图形与y轴断开连接.我想知道是否有人遇到同样的问题?如您所见,我尝试使用轴偏移进行播放.无法解决问题.
AmCharts.ready(function(){图表=新的AmCharts.AmSerialChart();chart.dataProvider = chartData;chart.categoryField =时间戳";chart.startDuration = 0;chart.pathToImages ="/design/javascripts/amcharts/images/";chart.zoomOutButton = {var valueAxis = new AmCharts.ValueAxis();valueAxis.title ="{t}展示次数{/t}";valueAxis.offset = -25;valueAxis.stackType =常规";valueAxis.position =左";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 chart.categoryAxis.equalSpacing
设置为 true
,否则code>设置为 true
.如amcharts CategoryAxis文档中有关"startOnAxis"属性的说明:
指定图形是否应从轴开始.如果显示列,建议将其设置为false.如果parseDates设置为true,除非equalSpacing设置为true,否则startOnAxis始终为false.
My graph is disconnected from my y-axis on creation. I was wondering if anyone had the same problem? I tried playing with the axis-offset as you can see. does not fix the problem.
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
};
Please help
Set the startOnAxis
property of the categoryAxis
object to true
chart.categoryAxis.startOnAxis = true;
http://docs.amcharts.com/javascriptcharts/CategoryAxis
EDIT:
As martynasma suggested, you should note that this won't work if you have chart.categoryAxis.parseDates
set to true
unless you also set chart.categoryAxis.equalSpacing
to true
. As stated on the amcharts CategoryAxis documentation about "startOnAxis" property:
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.
这篇关于AmCharts折线图与Axis断开连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!