彩票走势图

如何使用Essential Studio创建一个不连续范围的图表

原创|其它|编辑:郝浩|2012-10-18 15:32:27.000|阅读 268 次

概述:下面的代码示例演示了使用Essential Studio Reporting Edition创建一个具有不连续的数据范围图表的方法。

# 慧都年终大促·界面/图表报表/文档/IDE等千款热门软控件火热促销中 >>

下面的代码示例演示了使用Essential Studio Reporting Edition创建一个具有不连续的数据范围图表的方法。

[C#]

// Entering the data for the chart.
sheet.Range["A1"].Text = "Texas books Unit sales";
sheet.Range["A1:D1"].Merge();
sheet.Range["A1"].CellStyle.Font.Bold = true;
 
sheet.Range["B2"].Text = "Jan";
sheet.Range["C2"].Text = "Feb";
sheet.Range["D2"].Text = "Mar";
 
sheet.Range["A3"].Text = "Austin";
sheet.Range["A4"].Text = "Dallas";
sheet.Range["A5"].Text = "Houston";
sheet.Range["A6"].Text = "San Antonio";
 
sheet.Range["B3"].Number = 53.75;
sheet.Range["B4"].Number = 52.85;
sheet.Range["B5"].Number = 59.77;
sheet.Range["B6"].Number = 96.15;
 
sheet.Range["C3"].Number = 79.79;
sheet.Range["C4"].Number = 59.22;
sheet.Range["C5"].Number = 10.09;
sheet.Range["C6"].Number = 73.02;
 
sheet.Range["D3"].Number = 26.72;
sheet.Range["D4"].Number = 33.71;
sheet.Range["D5"].Number = 45.81;
sheet.Range["D6"].Number = 12.17;
 
sheet.Range["F1"].Number = 26.72;
sheet.Range["F2"].Number = 33.71;
 
sheet.Range["F3"].Number = 45.81;
sheet.Range["F4"].Number = 12.17;
 
// Discontiguous range.
IRanges rangesOne = sheet.CreateRangesCollection();
rangesOne.Add(sheet.Range["B3:B6"]);
rangesOne.Add(sheet.Range["F1:F2"]);
 
IRanges rangesTwo = sheet.CreateRangesCollection();
rangesTwo.Add(sheet.Range["D3:D6"]);
rangesTwo.Add(sheet.Range["F3:F4"]);
 
// Adding a New (Embedded chart)to the Worksheet.
IChartShape shape = sheet.Charts.Add();
shape.PrimaryCategoryAxis.Title = "City";
shape.PrimaryValueAxis.Title = "Sales (in Dollars)";
shape.ChartTitle = "Texas Books Unit Sales";
 
// Setting the Series Names in a Legend.
IChartSerie serieOne = shape.Series.Add();
serieOne.Name = "Jan";
serieOne.Values = rangesOne;
 
IChartSerie serietwo = shape.Series.Add();
serietwo.Name = "March";
serietwo.Values = rangesTwo;
 
// Setting the(Rows & Columns)Property for the Embedded chart.
shape.BottomRow = 40;
shape.TopRow = 10;
shape.LeftColumn = 3;
shape.RightColumn = 15;

[VB.NET]

' Entering the data for the chart.
sheet.Range("A1").Text = "Texas books Unit sales"
sheet.Range("A1:D1").Merge()
sheet.Range("A1").CellStyle.Font.Bold = True
 
sheet.Range("B2").Text = "Jan"
sheet.Range("C2").Text = "Feb"
sheet.Range("D2").Text = "Mar"
 
sheet.Range("A3").Text = "Austin"
sheet.Range("A4").Text = "Dallas"
sheet.Range("A5").Text = "Houston"
sheet.Range("A6").Text = "San Antonio"
 
sheet.Range("B3").Number = 53.75
sheet.Range("B4").Number = 52.85
sheet.Range("B5").Number = 59.77
sheet.Range("B6").Number = 96.15
 
sheet.Range("C3").Number = 79.79
sheet.Range("C4").Number = 59.22
sheet.Range("C5").Number = 10.09
sheet.Range("C6").Number = 73.02
 
sheet.Range("D3").Number = 26.72
sheet.Range("D4").Number = 33.71
sheet.Range("D5").Number = 45.81
sheet.Range("D6").Number = 12.17
 
sheet.Range("F1").Number = 26.72
sheet.Range("F2").Number = 33.71
 
sheet.Range("F3").Number = 45.81
sheet.Range("F4").Number = 12.17
 
' Discontiguous range.
Dim rangesOne As Syncfusion.XlsIO.IRanges = sheet.CreateRangesCollection()
rangesOne.Add(sheet.Range("B3:B6"))
rangesOne.Add(sheet.Range("F1:F2"))
 
Dim rangesTwo As Syncfusion.XlsIO.IRanges = sheet.CreateRangesCollection()
rangesTwo.Add(sheet.Range("D3:D6"))
rangesTwo.Add(sheet.Range("F3:F4"))
 
' Adding a New(Embedded chart)to the Worksheet.
Dim shape As Syncfusion.XlsIO.IChartShape = sheet.Charts.Add()
shape.PrimaryCategoryAxis.Title = "City"
shape.PrimaryValueAxis.Title = "Sales (in Dollars)"
shape.ChartTitle = "Texas Books Unit Sales"
 
' Setting the Series Names in a Legend.
Dim serieOne As Syncfusion.XlsIO.IChartSerie = shape.Series.Add()
serieOne.Name = "Jan"
serieOne.Values = rangesOne
 
Dim serietwo As Syncfusion.XlsIO.IChartSerie = shape.Series.Add()
serietwo.Name = "March"
serietwo.Values = rangesTwo
 
' Setting the (Rows & Columns)Property for the Embedded chart.
shape.BottomRow = 40
shape.TopRow = 10
shape.LeftColumn = 3
shape.RightColumn = 15

标签:

本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@pclwef.cn

文章转载自:慧都控件网

为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP