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

问题描述

如果值低于参考值,我想用两种颜色绘制迷你图,如果值高于相同的参考值,则用另一种颜色绘制。

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