如何在时间序列图表(FusionCharts/FusionTime)中设置单个图的样式?

问题描述 投票:0回答:1

我正在使用 FusionCharts 渲染时间序列折线图,如下所示:

const MyChart = () => {
    const schema = [
        {
            name: "Category",
            type: "string"
        },
        {
            name: "Time",
            type: "date",
            format: "%Y-%m-%d"
        },
        {
            name: "Value",
            type: "number"
        }
    ]

    const data = [
        ["CategoryToStyle", "2022-09-01", 5],
        ["CategoryToStyle", "2022-10-01", 10],
        ["Category2", "2022-09-01", 2],
        ["Category2", "2022-10-01", 7]
    ]

    const dataStore = new FusionCharts.DataStore().createDataTable(data, schema);

    const chartSettings = {
        type: "timeseries",
        dataSource: {
            data: dataStore,
            series: "Category",
            yAxis: {
                format: {
                    prefix: "$"
                }
            }
        }
    }

    return <ReactFC width={1024} height={1024} {...chartSettings} />
}

该图表呈现 2 个线图,一个用于

"CategoryToStyle"
系列,另一个用于
"Category2"
系列。

如何自定义系列线图的“笔画宽度”

"CategoryToStyle"

javascript reactjs fusioncharts react-fusioncharts
1个回答
-2
投票

使用plotConfig对象定义的样式范围为整个图表,即,如果您定义线图并将描边宽度的值设置为4,则图表中的所有线图的描边宽度都将设置为4像素。

 {
  "plotConfig": {
    "style": {
      "area": {
        "line": {
          "opacity": 1.0
        },
        "area": {
          "opacity": 0.3
        },
        "anchor": {
          "opacity": 0.7
        }
      }
    }
  }
}

要了解有关此功能的更多信息,请参阅 - https://www.fusioncharts.com/dev/fusiontime/fusiontime-component/plot-types-in-fusiontime#plot-configuration

© www.soinside.com 2019 - 2024. All rights reserved.