Hi all,
How to make pie charts/ line charts from the database data?
Thanks,
Darma
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Vishnujeet KumarRank #1,019 · 1.9K reputationPosted Nov 12, 2012, 5:21 AM EST
Useful article and chart control, try this .
http://www.dotnetspark.com/kb/2662-mschart---drilldown-charts-part-ii.aspx
http://social.msdn.microsoft.com/Forums/en-US/MSWinWebChart/threads/
White Evaln26 reputationPosted Nov 12, 2012, 8:32 PM EST
since the code is too long, I only show you a part of pie chart code:
chart1.CategoryLabels.ColX = ((System.Byte)(1));
chart1.CategoryLabels.ColY = ((System.Byte)(1));
chart1.CategoryLabels.RowX = 1;
chart1.CategoryLabels.RowY = 9;
chart1.CategoryLabelsColumn = "Name";
chart1.DataRangeSheet = "charts";
chart1.Position.AutoPosition.Height = 12;
chart1.Position.AutoPosition.Top = 1;
chart1.Position.AutoPosition.Width = 6;
chartSeries1.DataColumn = "Population";
chartSeries1.DataRangeSheet = "charts";
chartSeries1.Title = "Population";
chart1.Series.Add(chartSeries1);
chart1.Style = Spire.DataExport.XLS.ChartStyle.Pie3d;
chart1.Title = "Chart demo";
workSheet3.Charts.Add(chart1);
You can know more detail here:
Export to Excel and Create Pie Chart
Marina Eberhardt24 reputationPosted Nov 11, 2014, 12:00 AM EST
DataTable table = ... var ef = new ExcelFile(); var ws = ef.Worksheets.Add("Sheet"); ws.InsertDataTable(table); var chart = ws.Charts.Add(ChartType.Line, "A6", "F15"); chart.SelectData(ws.GetUsedCellRange(true), false, true, true); ef.Save("Sample.xlsx");