DotNet Highchart 中 Y 轴的两个不同数据范围

Two different data range for Y-axis in DotNet Highchart

亲爱的, 当我在我的代码中使用 Dotnet highcharts 时,我需要有两个不同的 y 轴范围。这是 excel 中的一个示例,向您展示 y 的两个范围是什么。我已经可以将两个数据源添加到我的图表中了。其中一个是面积图,另一个是折线图。但是折线图数据范围在80到90之间,面积数据范围在5000到8000之间。y轴的单一范围,由于数据范围不同,折线图不能很好地显示。 在这种情况下有人可以帮助我吗? 非常感谢 enter image description here

我找到了解决办法。您应该在您的 yAxis 道具中使用此代码,并将 YAxis= 1 添加到您的图表数据系列之一的 setseries 道具中。它将优先考虑您的图表。例如,如果您有 3 个图表,一个区域,两条线。那么您应该将 YAxis = 1 添加到面积图的 setseries 对象,然后将 yAxis = 2 添加到其中一个折线图的 setseries 道具。

.SetYAxis(new[]
            {
                new YAxis
                {
                    TickInterval = 100,
                    Labels = new YAxisLabels
                    {
                        Formatter = "function() { return this.value +'°C'; }",
                        Style = "color: '#89A54E'"
                    },
                    Title = new YAxisTitle
                    {
                        Text = "Temperature",
                        Style = "color: '#89A54E'"
                    }
                },
                new YAxis
                {
                    Min= 60,
                    Max=100,
                    TickInterval=2,
                    Labels = new YAxisLabels
                    {
                        Formatter = "function() { return this.value; }",
                        Style = "color: '#4572A7'"
                    },
                    Title = new YAxisTitle
                    {
                        Text = "Rainfall",
                        Style = "color: '#4572A7'"
                    },
                    Opposite = true
                }
            })