Spread Studio V10 新功能 - 旭日图(Sunburst Chart)

发布时间:2017/02/03 00:02 发布者:dexteryao

返回博客中心

旭日图(Sunburst Chart) 可以有效地以视觉方式显示分层数据。例如,您可以在旭日图中方便的找到某一家店铺的的哪种商品的销量最高。

在Spread Studio V10中, Windows Forms 和 ASP.NET 平台新增了旭日图(Sunburst Chart)。

从下图中,您可以轻松看出每家店铺不同产品的销量。

 

1486094019(1)

1. 通过代码创建旭日图

            // Create a Sunburst series. 
            FarPoint.Win.Chart.SunburstSeries series = new FarPoint.Win.Chart.SunburstSeries();
            // Add data. 
            series.Values.AddRange(new double[] { 350, 100, 80, 85, 90, 200, 300, 450, 500, 650, 220 });
            // Set any colors
            series.Fills.AddRange(new FarPoint.Win.Chart.Fill[] {
                new FarPoint.Win.Chart.SolidFill(Color.Blue),
                new FarPoint.Win.Chart.SolidFill(Color.Teal),
                new FarPoint.Win.Chart.SolidFill(Color.DarkGoldenrod),
                new FarPoint.Win.Chart.SolidFill(Color.DarkSalmon),
                new FarPoint.Win.Chart.SolidFill(Color.DarkGreen),
                new FarPoint.Win.Chart.SolidFill(Color.Chocolate),
                new FarPoint.Win.Chart.SolidFill(Color.Navy),
                new FarPoint.Win.Chart.SolidFill(Color.DarkOrange),
                new FarPoint.Win.Chart.SolidFill(Color.OrangeRed),
                new FarPoint.Win.Chart.SolidFill(Color.Tomato),
                new FarPoint.Win.Chart.SolidFill(Color.Firebrick),
                new FarPoint.Win.Chart.SolidFill(Color.Gray),
                new FarPoint.Win.Chart.SolidFill(Color.Olive),
                new FarPoint.Win.Chart.SolidFill(Color.Teal) });
            // Add text strings for the data. 
            FarPoint.Win.Chart.StringCollectionItem collection1 = new FarPoint.Win.Chart.StringCollectionItem(); collection1.AddRange(new String[] { "Store 1", "", "", "", "", "", "Store 2", "", "", "Store 3" });
            FarPoint.Win.Chart.StringCollectionItem collection2 = new FarPoint.Win.Chart.StringCollectionItem(); collection2.AddRange(new String[] { "Asagio", "Swiss", "Muenster", "Blue", "Cabot", "Gouda", "Feta", "Brie", "Stilton", "American", "Asagio" });
            FarPoint.Win.Chart.StringCollectionItem collection3 = new FarPoint.Win.Chart.StringCollectionItem();
            series.CategoryNames.AddRange(new FarPoint.Win.Chart.StringCollectionItem[] { collection1, collection2 });
            // Add any legends or labels. 
            FarPoint.Win.Chart.LegendArea label = new FarPoint.Win.Chart.LegendArea();
            label.TextFont = new System.Drawing.Font("Calibri", 10);
            label.TextFill = new FarPoint.Win.Chart.SolidFill(System.Drawing.Color.Black);
            // Create a plot area and add the series to the plot area. 
            FarPoint.Win.Chart.SunburstPlotArea plotArea = new FarPoint.Win.Chart.SunburstPlotArea();
            plotArea.Location = new PointF(0.2f, 0.2f);
            plotArea.Size = new SizeF(0.6f, 0.6f);
            plotArea.Series.Add(series);
            // Create a chart model and add the plot area and legend. 
            FarPoint.Win.Chart.ChartModel model = new FarPoint.Win.Chart.ChartModel();
            model.PlotAreas.Add(plotArea);
            model.LegendAreas.Add(label);
            // Create a chart object, set the size and location, and assign the model.
            FarPoint.Win.Spread.Chart.SpreadChart chart = new FarPoint.Win.Spread.Chart.SpreadChart();
            chart.Size = new Size(600, 700);
            chart.Location = new System.Drawing.Point(50, 10); chart.Model = model;
            // Add the chart to Spread.
            fpSpread1.Sheets[0].Charts.Add(chart);

2. 使用设计器添加旭日图

和在Excel中一样,只需要选择数据源,插入旭日图即可。

1486094569(1)

1486094599(1)

1486094632(1)

 

更多资源

如果您对Spread Studio产品感兴趣,请到官方网站下载试用:/developer/spreadstudio

产品咨询电话:400-657-6008

如果你有疑问,可以到GCDN论坛获得技术支持:http://gcdn.grapecity.com.cn


关于葡萄城

赋能开发者!葡萄城是专业的集开发工具、商业智能解决方案、低代码开发平台于一身的软件和服务提供商,为超过 75% 的全球财富 500 强企业提供服务。葡萄城专注控件软件领域30年,希望通过模块化的开发控件、灵活的低代码应用开发平台等一系列开发工具、解决方案和服务,帮助开发者快速响应复杂多变的业务需求,最大程度地发挥开发者的才智和潜能,让开发者的 IT 人生更从容更美好。

了解详情,请访问葡萄城官网