我的图表的边框颜色

时间:2017-03-22 11:01:12

标签: javascript jquery amcharts

我用amcharts制作了一个示例图表 问题是边界的不同颜色。当你仔细观察时,你会看到左边框和下边框是黑色的,而顶部和右边的边框是灰色的:

enter image description here

有没有办法控制边框颜色?我希望他们都是灰色的。

这是代码:

var chart = AmCharts.makeChart("chartdiv", {
  "type": "xy",
  "autoMarginOffset": 20,
  "dataProvider": data,
  "valueAxes": [{
    "position": "bottom",
    "axisAlpha": 0,
  }, {
    "position": "left",
    "axisAlpha": 0,
  }, {
    "id": "v3",
    "position": "right",
    "axisAlpha": 0
  }],
  "graphs": [{
    "bullet": "round",
    "xField": "ax",
    "yField": "ay",
    "fillAlphas": 0
  }, {
    "bullet": "round",
    "xField": "bx",
    "yField": "by",
    "yAxis": "v3",
  }]
});

Here is a fiddle

1 个答案:

答案 0 :(得分:0)

线条已经是灰色(技术上是黑色,默认情况下gridAlpha为0.15),但是网格线在多个轴的零点重叠会导致左侧和底部的轴线看起来更暗。

您必须在所有轴中将zeroGridAlpha设置为0,以使左侧和底部的线看起来更像图表的其他边:

  "valueAxes": [{
    "position": "bottom",
    "axisAlpha": 0,
    "zeroGridAlpha": 0
  }, {
    "position": "left",
    "axisAlpha": 0,
    "zeroGridAlpha": 0
  }, {
    "id": "v3",
    "position": "right",
    "axisAlpha": 0,
    "zeroGridAlpha": 0
  }],

Updated fiddle