【问题标题】:How can I draw sparkline graphs in two colors如何用两种颜色绘制迷你图
【发布时间】:2021-05-11 10:17:58
【问题描述】:

我想用两种颜色绘制迷你图线,这取决于该值是否低于参考值,如果该值高于相同的参考值,则使用另一种颜色。

const conf: EvolutionChartConfiguration<LaborGridAnalysis> = {
        dateField: 'Date',
        hideGrid: true,
        hideTooltip: true,
        hideLabel: true,
        seriesGroups: [
            {
                series: [
                    {
                    field: field,
                    type: type,
                    color: colorSerie,
                    label: label,
                    shape: 'line',
                    shownOnScrollbar: false,
                    hideLineBullets: true
                }]
            }
        ]
    };
    return conf;

谢谢

【问题讨论】:

    标签: amcharts amcharts4


    【解决方案1】:

    明白了。在这种情况下,您将有这样的代码:

    // This set line color to green
    series.stroke = am4core.color("#00ff00");
    
    // This set line color to red above 100
    var range = valueAxis.createSeriesRange(series);
    range.value = 100;
    range.endValue = 100000;
    range.contents.stroke = am4core.color("#ff0000");
    

    【讨论】:

      猜你喜欢
      • 2015-07-11
      • 2021-03-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多