Highcharts Sunburst水平半径

时间:2018-05-21 09:01:13

标签: highcharts dotnethighcharts

我用Highcharts .NET制作了一个旭日形象,

这是我设置图表的方式:

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,
        //LevelSize = new SunburstSeriesLevelSize
        //{
        //    Unit = SunburstSeriesLevelSizeUnit.Percentage,
        //    Value = 100
        //},
        Levels = new List<SunburstSeriesLevels>
        {
            new SunburstSeriesLevels
            {
                LevelSize = new SunburstSeriesLevelsLevelSize{
                    Unit = SunburstSeriesLevelsLevelSizeUnit.Percentage,
                    Value = 90
                }
            },
            new SunburstSeriesLevels
            {
                LevelSize = new SunburstSeriesLevelsLevelSize{
                    Unit = SunburstSeriesLevelsLevelSizeUnit.Percentage,
                    Value = 10
                }
            }
        }
       }
    }
};

我尝试了很多方法,但是水平半径永远不会改变,我错过了什么?

唯一有效的是整个系列的等级,但我需要设置特定级别的大小。

我试图搜索,但看起来没有人遇到任何问题。

1 个答案:

答案 0 :(得分:0)

等级对象levelSize能够控制个别等级的大小。它有两个属性:unitpixels / percentage / weight)和value(由单位确定):

    levels: [{
        level: 1,
        levelIsConstant: false,
        levelSize: {
            unit: 'pixels',
            value: 30
        }
    }, {
        level: 2,
        colorByPoint: true,
        dataLabels: {
            rotationMode: 'parallel'
        }
    }, {
        level: 3,
        levelIsConstant: true,
        levelSize: {
            unit: 'weight',
            value: 2
        }
    }, {
        level: 4,
        levelIsConstant: true,
        levelSize: {
            unit: 'percentage',
            value: 30
        }
    }]

现场演示: http://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/sunburst-levelsize/

API参考: https://api.highcharts.com/highcharts/series.sunburst.levelSize