如何通过 amcharts v4 中的 json 配置手动设置 LineSeries 的颜色?

How to manually set a color of a LineSeries via json config in amcharts v4?

如何在 amcharts v4 中通过 json 配置手动设置 LineSeries 的颜色?

我试了很多属性都没有效果:

    ...
    "series": [
        {
            "type": "LineSeries",
            "propertyFields": {
                "stroke": "#color",
                "fill":   "#color"
            }
        },
        {
            "type": "LineSeries",
            "color": "#color"
        },
        {
            "type": "LineSeries",
            "fill": "#color"
        },
        {
            "type": "LineSeries",
            "sprite": {
                "color": "#color"
            }
        },
        {
            "type": "LineSeries",
            "sprite": {
                "fill": "#color"
            }
        },
        {
            "type": "LineSeries",
            "stroke": {
                "color": "#color"
            }
        },
        {
            "type": "LineSeries",
            "stroke": {
                "fill": "#color"
            }
        }
    ]

amcharts v4有手动设置线条颜色的简便方法吗?

你几乎成功了。您必须在 LineSeries 定义 (see JSON tab in the docs) 的 top-level 处设置 stroke:

"series": [{
  "type": "LineSeries",
  "stroke": "#567890",
  // ...
},
// ...
]

JSON 值与声明语法非常接近,hierarchy-wise。您可以在 github repo.

中找到更完整的 JSON 示例