BrainDump
  Home arrow BrainDump arrow Page 5 - Working with NetSpell and NPlot
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 
Mobile Linux 
App Generation ROI 
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? 
BRAINDUMP

Working with NetSpell and NPlot
By: O'Reilly Media
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 2
    2007-08-27

    Table of Contents:
  • Working with NetSpell and NPlot
  • Using NetSpell
  • 4.7 Creating Graphs and Plot Charts Quickly with NPlot
  • Plots and drawable objects
  • Producing graphs from data sources

  • 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
     
     
    ADVERTISEMENT


    Working with NetSpell and NPlot - Producing graphs from data sources


    (Page 5 of 5 )

    NPlot’s distribution includes a nice demo application that runs through many of NPlot’s chart types. The application demonstrates just how easy it is to feed data sources into a plot object and produce a detailed graph. Example 4-3 shows extracts from the demo app for creating a CandlePlot graph showing stock price data.

    Example 4-3. Creating a CandlePlot from an XML file

    // The plot surface to hold graphs. Note the surface is an
    //    NPlot.Windows.PlotSurface2D class instead of
    //    NPlot.PlotSurface2D. The utilized class derives from
    //    Forms.UserControl and automatically paints itself.
    private NPlot.Windows.PlotSurface2D plotSurface;
    // obtain stock information from XML file DataSet ds = new DataSet();
    System.IO.Stream file = Assembly.GetExecutingAssembly().GetManifestResourceStream(
           
    "NPlotDemo.resources.asx_jbh.xml" ); ds.ReadXml( file, System.Data.XmlReadMode.ReadSchema ); DataTable dt = ds.Tables[0];
    // create CandlePlot
    CandlePlot cp = new CandlePlot(); cp.DataSource = dt;
    cp.AbscissaData = "Date";
    cp.OpenData = "Open";
    cp.LowData = "Low";
    cp.HighData = "High";
    cp.CloseData = "Close";
    cp.BearishColor = Color.Red;
    cp.BullishColor = Color.Green;
    cp.StickWidth = 3;
    cp.Color = Color.DarkBlue;

    plotSurface.Add( new Grid() ); plotSurface.Add( cp );

    plotSurface.Title = "AU:JBH"; plotSurface.XAxis1.Label = "Date / Time"; plotSurface.YAxis1.Label = "Price [$]";

    plotSurface.Refresh();

    An input record from the XML data file looks like this:

      <asx_jbh>
          <ID>1270061</ID>
          <CompanyID>800</CompanyID>
          <Date>2003-10-23T00:00:00.0000000+10:00</Date>
          <Open>2.2</Open>
          <Low>2.15</Low>
          <High>2.27</High>
          <Close>2.25</Close>
          <Volume>28859100</Volume>
          <AdjClose>2.25</AdjClose>
      </asx_jbh>

    Figure 4-21 shows the graph produced by this code and data.

    NPlot offers great flexibility for combining plot types, too. Figure 4-22 shows the power of NPlot by layering multiple y-axes, a dashed-line plot, and a histogram plot.

    Getting Support

    Support for NPlot is limited to submitting bug reports at its home page.

     


    Figure 4-21.  CandlePlot generated from example code


    Figure 4-22.  A complex graph using multiple types

    NPlot in a Nutshell

    The current version of NPlot is 0.9.9.3—-it has not yet reached version 1.0. This reflects the following facts:

    • Some functionality that many users expect from a charting library is still missing.
      NPlot is not yet considered basic-feature complete (though it is getting close).
    • The API is still subject to change without notice and without regard to backwardcompatibility.
      The focus remains on creating the best library design possible.
    • There are no separate development/stable branches of the code. A given release of
      NPlot may include both bug fixes and significant enhancements. The latter have
      the potential to break functionality that worked in previous releases.

    That said, NPlot is known to be used reliably in several production systems.

    NPlot is an easy-to-use, flexible charting library that has a wide range of applications. It is under active development, with particular focus on polishing the interface and achieving a very stable release for version 1.0.

    —Matt Howell, creator of NPlot

    Please check back tomorrow for the continuation of this article.


    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.

       · This article is an excerpt from the book "Windows Developer Power Tools," published...
     

    Buy this book now. This article is excerpted from chapter four of the book Windows Developer Power Tools, written by James Avery and Jim Holmes (O'Reilly; ISBN: 0596527543). Check it out today at your favorite bookstore. Buy this book now.

    BRAINDUMP ARTICLES

    - Internet Explorer 8 Review
    - Nilpo`s Top Windows Add-Ons
    - Beginning Silverlight 2.0 Development using ...
    - Fixing Vista`s Troubles
    - Preparing Windows Images for Mass Deployment
    - The Trouble With Vista
    - Slipstreamed and Unattended Windows Installa...
    - Microsoft Office SharePoint Server
    - Microsoft Office SharePoint Designer
    - Microsoft Windows SharePoint Services 3.0
    - Microsoft Live Mesh Overview
    - XAML Brushes and Silverlight
    - Silverlight and XAML Basics
    - Immortal XP
    - XAML Basics





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
    Stay green...Green IT