Using Microsoft's Chart Controls In An ASP.NET Application: Serializing Chart Data

In most usage scenarios, the data displayed in a Microsoft Chart control comes from some dynamic source, such as from a database query. The appearance of the chart can be modified dynamically, as well; past installments in this article series showed how to programmatically customize the axes, labels, and other appearance-related settings. However, it is possible to statically define the chart's data and appearance strictly through the control's declarative markup. One of the demos examined in the Getting Started article rendered a column chart with seven columns whose labels and values were defined statically in the <asp:Series> tag's <Points> collection.

Given this functionality, it should come as no surprise that the Microsoft Chart Controls also support serialization. Serialization is the process of persisting the state of a control or an object to some other medium, such as to disk. Deserialization is the inverse process, and involves taking the persisted data and recreating the control or object. With just a few lines of code you can persist the appearance settings, the data, or both to a file on disk or to any stream. Likewise, it takes just a few lines of codes to reconstitute a chart from the persisted information.

This article shows how to use the Microsoft Chart Control's serialization functionality by examining a demo application that allows users to create custom charts, specifying the data to plot and some appearance-related settings. The user can then save a "snapshot" of this chart, which persists its appearance and data to a record in a database. From another page, users can view these saved chart snapshots. Read on to learn more!



About the Author

Scott Mitchell

Scott Mitchell is the Editor, founder, and primary contributor to 4GuysFromRolla.com. In addition to founding 4GuysFromRolla.com, Scott also created ASPFAQs.com and ASPMessageboard.com. He works as a freelance writer, trainer, and consultant and resides in California.

Comments

  • How to make chart labels take its full space in StackedColumn series

    Posted by Mansour on 09/01/2012 10:08pm

    I have StackedColumn chart, small vlaues on label came above and near together, means it doesnt set to its place how can i set every label to its place , for example if label has few value 2 % its coming above and also its label height came so small below is screen shot for the chart, the labels come near together to above ones. there is one label takes 98 % and other one 2 % . the one 2 % appeasr so small and also the number comes above it.

    Reply
  • Thanks

    Posted by patidarnilesh on 02/10/2010 01:53pm

    [url=http://www.themortgagebroker.co.uk]mortgage broker[/url]
    [url=http://www.equity-release-lifetime-mortgage-schemes.co.uk/equity-release-schemes/lifetime-mortgage.html]lifetime mortgage[/url]

    Reply
  • Thanks

    Posted by patidarnilesh on 02/10/2010 01:52pm

    Dear Friend,
    
    Thanks for the help and giving us the new information.
    
    ==============================
    
    [url=http://www.themortgagebroker.co.uk/life-assurance.html]Life Assurance[/url]
    [url=http://www.equity-release-lifetime-mortgage-schemes.co.uk/equity-release-schemes/]equity release schemes[/url]

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: November 20, 2014 @ 2:00 p.m. ET / 11:00 a.m. PT Are you wanting to target two or more platforms such as iOS, Android, and/or Windows? You are not alone. 90% of enterprises today are targeting two or more platforms. Attend this eSeminar to discover how mobile app developers can rely on one IDE to create applications across platforms and approaches (web, native, and/or hybrid), saving time, money, and effort and introducing apps to market faster. You'll learn the trade-offs for gaining long …

  • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds