我有一个XY
amcharts图表,x轴从0到250,步长为50。
由于我的分数用30分隔,我希望在网格和轴标签中有30步。
我想更改ValueAxis
的{{3}}属性,但它是只读的。
我尝试设置"autoGridCount": false
并增加"gridCount"
:在12,步骤为20,在13,步骤为50.有人说改变labelFrequency
,但我看不到任何效果通过增加或减少它。
我怎么能得到这个?
答案 0 :(得分:2)
var chart = AmCharts.makeChart("chartdiv", {
"type": "xy",
"dataProvider": json,
"autoMargins": true,
"autoMarginOffset" : 10, //Space left from axis labels/title to the chart's outside border, if autoMargins set to true.
"valueAxes":
[
{
"id":"my_y",
"minorGridEnabled" : true,
"title":"Y AXIS",
"autoGridCount": false,
"position": "left",
"tickLength":0,
"minimum":0,
"maximum":240,
"gridCount": 32,
"labelFrequency" : 1.5,
"gridColor":"black", // center y axis
"gridAlpha":0.50, // grids visibily strength
"axisAlpha":0, // default axis at right hidden
},
{
"id":"my_x",
"minorGridEnabled" : true,
"title":"X AXIS",
"autoGridCount": false,
"position": "bottom",
"tickLength":0,
// "gridThickness": 0.25,
"minimum": 0,
"maximum":240,
"gridCount": 32,
"labelFrequency" : 1.5,
"gridColor":"black", // center x axis
"gridAlpha":0.50, // grids visibily strength
"axisAlpha":0, // default axis at bottom hidden
"strictGridCount" : true,
},
],
"borderAlpha" : 0, // opacity border of chart
"startDuration": 0, // animation , 0 = no animation
"legend":[{
"useGraphSettings": false,
"verticalGap":0,
}],
"graphs":
[
{
"id":"g1",
// "valueAxis": "v1",
"lineColor": "#FF6600",
// "bullet": "round",
"bulletBorderThickness": 1,
"hideBulletsCount": 30,
"animationDuration":0,
"bullet": "circle",
"colorField":"mycolor",
"valueField": "value",
"xField": "x",
"yField": "y",
"fillAlphas": 0, // 0 to avoid creating filled polygon with bullets, default = 0
"bulletBorderAlpha": 0,
"minBulletSize": 30,
"maxBulletSize": 30,
"labelText":"[[x]]",
"labelPosition":"inside",
"markerType" : "none",
"switchable":false,
},
],
"marginLeft": 20,
"marginBottom": 20,
"listeners": [
{
"event": "drawn",
"method": addLegendLabel
},
],
"export": {
"enabled": true,
"menu" : [],
},
});
答案 1 :(得分:-1)
对我来说gridCount有效。 这是我的轴 -
"autoGridCount": false,
"minimum":-100,
"maximum":100
"gridCount": 21,
它给出了10步的步骤