0

我正在使用 dotnethighcharts 并希望列的 pointwidth=20,但我无法让它与 dotnethighcharts 一起使用,有什么建议吗?

      Highcharts chart;
        chart = new Highcharts("chart")
            .InitChart(new Chart { DefaultSeriesType = ChartTypes.Column })
            .SetXAxis(new XAxis
            {
                Categories = new[] { "1", "2" },
                Title = new XAxisTitle { Text = string.Empty }
            })
            .SetPlotOptions(new PlotOptions
            {
                Bar = new PlotOptionsBar
                {
                    DataLabels = new PlotOptionsBarDataLabels { Enabled = true }
                },
            })

            .SetSeries(new[]
            {
                new Series {Name = "1", Data = new Data(new object[] {1})},
                new Series {Name = "2", Data = new Data(new object[] {4})}
            });

这是一个如何使用点宽度的示例 http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/plotoptions/column-pointwidth-20/

4

1 回答 1

0

答案 - 我错过了这个

 Column = new PlotOptionsColumn
                {
                    PointPadding = 0.2,
                    PointWidth = 40,
                    BorderWidth = 0
                }

这是所有代码

    Highcharts chart;
    chart = new Highcharts("chart")
        .InitChart(new Chart { DefaultSeriesType = ChartTypes.Column })
        .SetXAxis(new XAxis
        {
            Categories = new[] { "1", "2" },
            Title = new XAxisTitle { Text = string.Empty }
        })
        .SetPlotOptions(new PlotOptions
        { 
             Column = new PlotOptionsColumn
                {
                    PointPadding = 0.2,
                    PointWidth = 40,
                    BorderWidth = 0
                },
            Bar = new PlotOptionsBar
            {
                DataLabels = new PlotOptionsBarDataLabels { Enabled = true }
            },
        })

        .SetSeries(new[]
        {
            new Series {Name = "1", Data = new Data(new object[] {1})},
            new Series {Name = "2", Data = new Data(new object[] {4})}
        });
于 2015-08-04T05:26:14.143 回答