gpt4 book ai didi

javascript - Amchart XY x 轴步长

转载 作者:行者123 更新时间:2023-12-03 06:34:36 28 4
gpt4 key购买 nike

我有一个 XY amcharts 图表,其 x 轴从 0 到 250,步长为 50。

由于我的点以 30 分隔,因此我希望网格和轴标签中的步长为 30。

我想更改 step我的 ValueAxis 的属性,但它是只读的。

我尝试设置 "autoGridCount": false 并增加 "gridCount" :在 12 时,步长为 20,在 13 时,步长为 50。有人说更改labelFrequency,但我发现增加或减少它没有任何效果。

我怎样才能得到这个?

最佳答案

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" : [],
},
});

希望这是你想要的..抱歉上次太匆忙,所以答案不明确 enter image description here

关于javascript - Amchart XY x 轴步长,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38285627/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com