Created
November 2, 2022 19:30
-
-
Save bjoerntx/e1b992e65ae27d87b8d2f4510e1a3c77 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create a new chart control | |
Chart chart = new Chart(); | |
// add a chart area | |
chart.ChartAreas.Add("chartArea1"); | |
chart.Series.Add("series1"); | |
chart.Series["series1"].ChartArea = "chartArea1"; | |
chart.Series["series1"].ChartType = SeriesChartType.Bar; | |
// connect to a data source | |
DataSet ds = new DataSet(); | |
ds.ReadXml("data.xml"); | |
chart.Series[0].XValueMember = ds.Tables[0].Columns[0].ColumnName; | |
chart.Series[0].YValueMembers = ds.Tables[0].Columns[1].ColumnName; | |
chart.DataSource = ds.Tables[0]; | |
chart.DataBind(); | |
// create a chart frame | |
TXTextControl.DataVisualization.ChartFrame frame = | |
new TXTextControl.DataVisualization.ChartFrame(chart); | |
frame.Name = "points"; | |
// add chart to the document | |
textControl1.Charts.Add(frame, -1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment