Udostępnij za pośrednictwem


MS Chart Control: Getting Started

Scott Mitchell wrote a great series of articles where he describes how to use Microsoft Chart control from simple binding to more complex scenarious. I highly recommend to read his articles for everybody starting working on the control: https://www.4guysfromrolla.com/articles/072209-1.aspx 

 Alex.

Comments

  • Anonymous
    January 04, 2010
    Thanks for your blogs, they've been very helpful.  Had a question for you -- are you familiar with the process of extracting SSRS metadata, from both the database and the .rdl files ?
  • Anonymous
    January 10, 2010
    Hi Alex,I'm trying to draw multiple graphs, one for each sCyt in my list of unique strings with2 series - "MEAN" and "StdDev" - in each graph.So, I'm running the method below in a loop, and I'm getting multiple areas on my chart,but all of them except the first one are blank, and all series, legends,etc. are drawnin the first ChartArea.Could you please tell me what am I doing wrong?Your help is much appreciated,Igorbmigor@hotmail.comprivate void showChart(DataSet dataSource, String sCyt, int ii)       {      ChartArea asCyt = new ChartArea(sCyt);            asCyt.Position.Auto = true;                       chartCyt.ChartAreas.Add(asCyt);           chartCyt.DataSource = dataSource;                     chartCyt.Legends.Add(sCyt);           chartCyt.Series.Add(sCyt);           chartCyt.Series.Add(sCyt + 1);           chartCyt.Series[2ii].XValueMember = "rownum";           chartCyt.Series[2ii].YValueMembers = "Mean";           chartCyt.Series[2ii].LegendText = "MEAN  (" + sCyt + ")";           chartCyt.Series[2ii + 1].XValueMember = "rownum";           chartCyt.Series[2ii + 1].LegendText = "     SD  (" + sCyt + ")";           chartCyt.Series[2ii + 1].YValueMembers = "StdDev";           chartCyt.Series[2*ii + 1].ChartType = SeriesChartType.Point;           chartCyt.ChartAreas[ii].AxisX.MajorGrid.Enabled = false;           chartCyt.ChartAreas[ii].AxisX.Title = "Stim Concentration";           chartCyt.ChartAreas[ii].AxisX.LabelStyle.Interval = 1;           chartCyt.DataBind();           for (int i = 0; i < chartCyt.Series[sCyt].Points.Count; i++)           {               chartCyt.Series[sCyt].Points[i].AxisLabel = _arrXlabel[i];           }       }
  • Anonymous
    January 14, 2010
    Hi AlexIs it possible to use this control for SQL Server Reporting Services?Thanks in advance.
  • Anonymous
    May 01, 2010
    Hello,i want to create x axis just like below pictures.http://img2.pict.com/e9/3a/99/3439672/0/800/1.jpgcould you please help me?thank u.
  • Anonymous
    July 06, 2010
    For those looking for some documentation on how to get started with VS.NET 2010 from an upgraded 2008 project, check out the following:Updating Microsoft Charting Controls for .NET from VS.NET 2008 to VS.NET 2010:allen-conway-dotnet.blogspot.com/.../updating-microsoft-charting-controls.html
  • Anonymous
    September 29, 2010
    Microsft Chart Control has less feature than the current dundas control.
  • Anonymous
    November 11, 2010
    GANTT chartsAre Gantt charts supported the same way as in Dundas?  The same features, options, etc?
  • Anonymous
    November 11, 2010
    GANTT chartsAre Gantt charts supported the same way as in Dundas?  The same features, options, etc?
  • Anonymous
    November 11, 2010
    GANTT chartsAre Gantt charts supported the same way as in Dundas?  The same features, options, etc?
  • Anonymous
    March 01, 2011
    Hi Alex,We are usign Chart control for real-time visualization of continuous-time data received at COM4 (SerialPort object).We implemented SerialPort_DataReceived event handler and enqueue the received data (Queue object).Then I used a Timer object as a fixed period of 10ms to update the Chart object (in the same way shown in the Real-Time data of the Examples for the Chart control) fron the data in the QueueWe programm a device attached to the USB port in the PC. The device emulate a COMx port. We define the samples per second (sps) in the device. At a speed of 100sps every thing works fine. However, at 500sps the application loses some data and the graph becomes like "noisy". We added an index for every received data that shows us that some "indexes" (and acordingly some data) lose.We notice that "DataReceived()" and "Tick()" events are asynchronous to each other and suspect this could be a problem becous if we are "receiving data" and "Tick()" event interrupts, the we may lose the current data.What do you think about?Can somebady provide some advice?Regards...Replays may be send to rr_campos@hotmail.com
  • Anonymous
    May 15, 2011
    Hi ,can i reduce the gap between exploded slices of a 3d pie graph?.I want slices to be little narrower.
  • Anonymous
    October 07, 2011
    chart1.Series[0]["PieLabelStyle"] = "Outside";thenhow can I control  its width.
  • Anonymous
    October 07, 2011
    chart1.Series[0]["PieLabelStyle"] = "Outside";thenhow can I control  its width.
  • Anonymous
    November 17, 2011
    hello,i want to know how to set Fixed interval number on each axis。when i used Maximum and Minmum tocome true,it throw a exception that is 'Axis Object - Auto Interval doesn’t have proper value'thank u!
  • Anonymous
    November 17, 2011
    hello,i want to know how to set Fixed interval number on each axis。when i used Maximum and Minmum tocome true,it throw a exception that is 'Axis Object - Auto Interval doesn’t have proper value'thank u!
  • Anonymous
    November 28, 2011
    Hi Alex - I have my chart displaying on screen and I can save it to a .jpg file. Now I want to print it. I can print it if I call it up as the file copy. But I can't print it directly from within VB2010. It's an object so I should be able to work out how to refer to it directly instead of as a file, but this appears to be beyond my capabilities. I can print rtf documents so may be I need to importthe chart to the rtf, add some text and then print it?Anything by way of code snippets to assign the chart so that it prints would be appreciated.   'Sub for printing graphic   Private Sub PrintGraphic(ByVal sender As Object, ByVal ev As PrintPageEventArgs)       ' Create the graphic using DrawImage       ev.Graphics.DrawImage(Image.FromFile(TextBox1.Text), ev.Graphics.VisibleClipBounds)       ' Specify that this is the last page to print       ev.HasMorePages = False   End Sub   Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click       'Print using and error handler to catch problems       'Dim PrintForm2 As New Form1       Try           AddHandler PrintDocument1.PrintPage, AddressOf Me.PrintGraphic           PrintDocument1.Print() 'print graphc       Catch ex As Exception           MessageBox.Show("Sorry, there is a problem printing", ex.ToString())       End Try   End SubThis code is from Alessandros Del Sole's book - VB2010 unleashed, and not original to me.Thanks Robert
  • Anonymous
    September 26, 2012
    Hi Alex.As you are an expert in chart, please, look my question in msdn forum:social.msdn.microsoft.com/.../f00a55be-8d5a-4015-8097-1e049ca9f1faDo you can help me?My  annotationline desapear when I move the scroolbar.Sorry for to use this comment, but I dont know other way to contact you.Thanks so much.