Where can I find a simple step by step introduction to MSChart
- Iv'e looked and looked until............ "IV'E GOT BLISTERS ON MY FINGERS!!"
Answers
I'll just paste this Samples Environment -link here anyway.. http://code.msdn.microsoft.com/mschart (What's wrong with the "Getting started" -section?)
I'll even add code to a very simple chart that has the basic scructure of almost any chart.
(0. Create chart in editor or some other way)
1. Create area, add area to chart.
2. Create series, assign series to area, add series to chart.
3. Add data to series.
(4. Add chart to some control, if not already created in editor)Imports System.Windows.Forms.DataVisualization.Charting Public Class ExampleForm Private Sub ExampleForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'Init chart 'This clears the default areas and series of the chart. '(The ones the editor adds automatically I think. Use those if you want.) Chart1.ChartAreas.Clear() Chart1.Series.Clear() 'Create a chartarea Dim area As New ChartArea("AREA") 'If you don't set these limits, they will be generated automatically depending on the data. area.AxisX.Minimum = 0 area.AxisX.Maximum = 5 area.AxisY.Minimum = 0 area.AxisY.Maximum = 100 'Add the chart area to the chart Chart1.ChartAreas.Add(area) 'Create a Series Dim series As Series = New Series("SERIES") series.ChartType = SeriesChartType.Column 'Assign the series to the area series.ChartArea = "AREA" 'Add the series to the chart Chart1.Series.Add(series) 'Add data to the series series.Points.AddXY(1, 50) series.Points.AddXY(2, 25) series.Points.AddXY(3, 70) series.Points.AddXY(4, 20) End Sub End Class
For a candlestick chart. Set the ChartType to Candlestick and set the data to something like:
'series.Points.AddXY(xvalue, bottomY, topY, bottomOfCandle, topOfCandle) series.Points.AddXY(1, 50, 80, 55, 60) series.Points.AddXY(2, 25, 40, 30, 35) series.Points.AddXY(3, 70, 90, 72, 88) series.Points.AddXY(4, 20, 70, 40, 50)- Marked As Answer byAlex GorevMSFT, OwnerWednesday, November 18, 2009 3:54 PM
- Hi Tom
welcome to the club :)
I started playing with the ChartControl a couple weeks ago.
I started with this page to kind of get orientated. It gave me an idea of how to set up a basic Chart
http://weblogs.asp.net/dwahlin/archive/2008/11/25/getting-started-with-the-asp-net-3-5-chart-control.aspx
and then just started writing code (my best way to learn), checking out the different methods, properties, etc for the ChartControl, trying different things and seeing what happens. I was quickly able to display data from a datatable.
There is also Alex Gorev's Weblog - who is heavily involved in this Forum. While I haven't gone through his examples, I will at some point.
http://blogs.msdn.com/alexgor/archive/tags/Chart/default.aspx- Marked As Answer byAlex GorevMSFT, OwnerWednesday, November 18, 2009 3:53 PM
All Replies
- YES! Good question, Tim. I've just started with the package, and frankly, the 'documentation' isn't. It's a fairly complete reference document, but after wasting an entire morning, I can still find absolutly nothing that simply describes how to properly initialze candlestick charts. And, before you say 'just look at the Samples', forget it. That 'solution' is a complete mess because by attempting to show everything, they confused the presentation to such an extent that it actually shows next to nothing, other than the highest-level description of what charting is about.
We need some concrete, simple EXAMPLES, like is always available in the MSDN help files, but which is completely missing from thie existing helps. I'll just paste this Samples Environment -link here anyway.. http://code.msdn.microsoft.com/mschart (What's wrong with the "Getting started" -section?)
I'll even add code to a very simple chart that has the basic scructure of almost any chart.
(0. Create chart in editor or some other way)
1. Create area, add area to chart.
2. Create series, assign series to area, add series to chart.
3. Add data to series.
(4. Add chart to some control, if not already created in editor)Imports System.Windows.Forms.DataVisualization.Charting Public Class ExampleForm Private Sub ExampleForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'Init chart 'This clears the default areas and series of the chart. '(The ones the editor adds automatically I think. Use those if you want.) Chart1.ChartAreas.Clear() Chart1.Series.Clear() 'Create a chartarea Dim area As New ChartArea("AREA") 'If you don't set these limits, they will be generated automatically depending on the data. area.AxisX.Minimum = 0 area.AxisX.Maximum = 5 area.AxisY.Minimum = 0 area.AxisY.Maximum = 100 'Add the chart area to the chart Chart1.ChartAreas.Add(area) 'Create a Series Dim series As Series = New Series("SERIES") series.ChartType = SeriesChartType.Column 'Assign the series to the area series.ChartArea = "AREA" 'Add the series to the chart Chart1.Series.Add(series) 'Add data to the series series.Points.AddXY(1, 50) series.Points.AddXY(2, 25) series.Points.AddXY(3, 70) series.Points.AddXY(4, 20) End Sub End Class
For a candlestick chart. Set the ChartType to Candlestick and set the data to something like:
'series.Points.AddXY(xvalue, bottomY, topY, bottomOfCandle, topOfCandle) series.Points.AddXY(1, 50, 80, 55, 60) series.Points.AddXY(2, 25, 40, 30, 35) series.Points.AddXY(3, 70, 90, 72, 88) series.Points.AddXY(4, 20, 70, 40, 50)- Marked As Answer byAlex GorevMSFT, OwnerWednesday, November 18, 2009 3:54 PM
- Thank you very much!
That's a start in the right direction, But where can I find "getting started" for MSChart. If the link you sent was suposed to get me to the documentation, I've already downloaded that. Although there are a few chunks of VB code scattered around in there, it seems to be set up more for VC. - Hi Tom
welcome to the club :)
I started playing with the ChartControl a couple weeks ago.
I started with this page to kind of get orientated. It gave me an idea of how to set up a basic Chart
http://weblogs.asp.net/dwahlin/archive/2008/11/25/getting-started-with-the-asp-net-3-5-chart-control.aspx
and then just started writing code (my best way to learn), checking out the different methods, properties, etc for the ChartControl, trying different things and seeing what happens. I was quickly able to display data from a datatable.
There is also Alex Gorev's Weblog - who is heavily involved in this Forum. While I haven't gone through his examples, I will at some point.
http://blogs.msdn.com/alexgor/archive/tags/Chart/default.aspx- Marked As Answer byAlex GorevMSFT, OwnerWednesday, November 18, 2009 3:53 PM
..If the link you sent was suposed to get me to the documentation, I've already downloaded that.
As I said in the previous post, it's a link to the Samples Environment. Click the Download -tab to find the download-links. Run the sample project and you'll find the Getting Started -section (at least in the Windows Forms Samples).
The links on the bottom (the documentation for example) of the article are "related" links.


