You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Highcharts .NET旭日图层级半径配置无效问题求助

解决Highcharts .NET旭日图特定层级半径不生效的问题

Hey Marco, I’ve run into this exact quirk with Highcharts .NET’s sunburst component before—let’s fix that level sizing issue!

The core problem here is that your Levels configuration is missing explicit LevelNumber assignments. Highcharts needs to know exactly which hierarchy level each of your size rules applies to; without this, it might not map your settings to the correct layers, even if you’ve ordered the list correctly.

修正后的配置代码

Here’s how to adjust your code to target specific levels properly:

Highcharts higcharts = new Highcharts {
    Chart = new Chart { 
        Type = ChartType.Sunburst, 
        Width = 700, 
        Height = 700 
    },
    Title = new Title { Text = "Monthly Average Temperature", X = -20 },
    Subtitle = new Subtitle { Text = "Source: WorldClimate.com", X = -20 },
    Legend = new Legend { 
        Layout = LegendLayout.Vertical, 
        Align = LegendAlign.Right, 
        VerticalAlign = LegendVerticalAlign.Middle, 
        BorderWidth = 0 
    },
    Series = new List<Series> { 
        new SunburstSeries { 
            Name ="Test", 
            Data = data,
            Levels = new List<SunburstSeriesLevels> { 
                // 对应最内层(第0层级)
                new SunburstSeriesLevels {
                    LevelNumber = 0,
                    LevelSize = new SunburstSeriesLevelsLevelSize{
                        Unit = SunburstSeriesLevelsLevelSizeUnit.Percentage,
                        Value = 90
                    }
                },
                // 对应第1层级(外层)
                new SunburstSeriesLevels {
                    LevelNumber = 1,
                    LevelSize = new SunburstSeriesLevelsLevelSize{
                        Unit = SunburstSeriesLevelsLevelSizeUnit.Percentage,
                        Value = 10
                    }
                }
            }
        } 
    }
};

关键注意事项

  • LevelNumber 是必须的: This property tells Highcharts which hierarchy layer your size rule targets. The numbering starts at 0 for the innermost circle, then increments outward.
  • 验证数据结构: Make sure your data collection correctly defines each point’s level or parent relationship. If your data’s hierarchy doesn’t align with the LevelNumber values you’ve set, the sizing rules won’t apply as expected.
  • 层级尺寸比例: When using Percentage units, ensure the sum of values across levels makes sense for your visualization (e.g., 90% + 10% = 100% for two levels, which keeps the total radius consistent with your chart’s size).

Give this adjusted code a test—your specific level radii should start behaving as expected now!

内容的提问来源于stack exchange,提问作者Marco Salerno

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 07:22:36