如何绘制两种颜色的迷你图

How can I draw sparkline graphs in two colors

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

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;

谢谢

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

// 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");