SunQuest
 
       Code Examples
  Home arrow Code Examples arrow Page 4 - The Basics of Charting with the MS Chart C...
IBM developerWorks
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Actuate Whitepapers 
VeriSign Whitepapers 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
CODE EXAMPLES

The Basics of Charting with the MS Chart Control
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 15
    2006-08-28

    Table of Contents:
  • The Basics of Charting with the MS Chart Control
  • What if the Chart Control is not installed?
  • Organization of the chart
  • Getting into the plot area

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
    Iron Speed
     
    ADVERTISEMENT

    AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th -1:00PM EST. Register Today!

    The Basics of Charting with the MS Chart Control - Getting into the plot area


    (Page 4 of 4 )

    Let's get some data into the plot area to see how this can be managed. The code shown in the next picture creates labels for the rows and the columns (Series). It also associates some data, albeit contrived to show how the data gets into the plot. Use another form in the same project, drop a chart control on the form, and to the form's load event, use the code shown in the next paragraph.

    Private Sub Form_Load()
    MSChart1.ToDefaults
    With MSChart1
        .ShowLegend = True
        .Column = 1
        .ColumnLabel = "red"
        .Column = 2
        .ColumnLabel = "green"
        .Column = 3
        .ColumnLabel = "blue"
        .Column = 4
        .ColumnLabel = "yellow"
        .Column = 5
        .ColumnLabel = "magenta"
        .Row = 1
        .RowLabel = "First"
        .Row = 2
        .RowLabel = "Second"
        .Row = 3
        .RowLabel = "Third"
        .Row = 4
        .RowLabel = "Four"
    End With 
    For i = 1 To 4
    With MSChart1
        .Row = i
        .Column = 1
        .Data = 200 + 50 * i
        .Column = 2
        .Data = 300
        .Column = 3
        .Data = 400 - 10 * i
        .Column = 4
        .Data = 500 - 20 * i
        .Column = 5
        .Data = 100
    End With
    Next i 
    End Sub 

    When the above code is executed the chart is displayed as shown in the next picture. The code syntax is not intuitive, especially concerning the current row and current column. You need to define a column by using the variable 'Column'; confer a label on it using 'ColumnLabel'; and associate a 'data' with it using 'data'. This setting in the Properties window is especially confusing. What's more, the definition in design may override the run time values.

    As for the data, the red bar increases; the blue and yellow bars decrease; and magenta and green stay constant. The chart appears to be automatically scaled. The title and foot note are left out.

    Summary

    This basic tutorial is a 101 level presentation of MS Chart Control. The material is very basic, but gives a good idea of how it is organized and how data may be plotted. Although individual data points have been associated with the rows and columns, the chart can be linked to data arrays as well as ADO and ActiveX Data Objects.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · There is always someone asking about this control and I am not sure whether...
       · check out chart controls from visifire. it is a great way of creating cool...
     

    CODE EXAMPLES ARTICLES

    - Handling Animations and Bitmaps Using GDI+ f...
    - Download a Web Page using the WebClient
    - Creating a Chart using Data from a Database ...
    - The Basics of Charting with the MS Chart Con...
    - Searching Body Text with textRange: Enter th...
    - Searching Body Text with textRange: Building...
    - Searching Body Text with textRange, part 1: ...
    - First Steps in Programming
    - Programming in C
    - Quick Introduction to ASF,ASX, and Networkin...
    - SatView: Pointer Perfect, Part 2: Constructi...
    - SatView: Pointer Perfect, Part 1
    - Style Case Studies: Construction Unions
    - Creating an Engine for Games for Windows
    - Style Case Studies: Generic Callbacks

    IBM developerWorks




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway