Overview: Using Microsoft Chart Controls from F#
Applies to: Functional Programming
Published: January 2010
Summary: This overview gives more information on using Microsoft Chart Controls directly from F#. It provides links to introductions as well as advanced topics including data binding and displaying real-time data.
This topic contains the following sections.
This article is associated with Real World Functional Programming: With Examples in F# and C# by Tomas Petricek with Jon Skeet from Manning Publications (ISBN 9781933988924, copyright Manning Publications 2009, all rights reserved). No part of these chapters may be reproduced, stored in a retrieval system, or transmitted in any form or by any means—electronic, electrostatic, mechanical, photocopying, recording, or otherwise—without the prior written permission of the publisher, except in the case of brief quotations embodied in critical articles or reviews.
The first article in this section provides an introduction to working with the Microsoft Chart Controls library. It covers the basic types used when creating charts and basic ways to configure the look of a chart.
The next two articles focus on several advanced aspects of using Chart Controls from F#. The second tutorial introduces data binding, which is an easy way to connect chart to a data source such as in-memory collection, database, or a CSV file stored on a disk. The last tutorial gives several examples of working with real-time data such as changing stock prices or the current CPU usage.
As explained in Overview: Charting Libraries for F#, using Chart Controls directly is appropriate when creating a custom library, tools, or an application that needs to directly control the chart. An alternative is to use the FSharpChart wrapper for F#. For more information about the library refer to the following articles:
This tutorial shows how to use the Microsoft Chart Controls library from F#. It explains how to create a chart, change its visual properties, and add another data series to the chart.
This tutorial shows how to specify a data source for a chart series declaratively using data binding. It demonstrates binding a series to a collection of values, binding to F# tuples, and binding to external data sources such as CSV files.
This tutorial demonstrates how to dynamically update a chart to display real-time data. It discusses how to use F# asynchronous workflows and how to receive updates on a background thread.
This article is written as a companion to Real World Functional Programming: With Examples in F# and C#. Book chapters related to the content of this article are:
Book Chapter 4: “Exploring F# and .NET libraries by example” demonstrates how to create a simple charting application from scratch. This chapter is useful for learning F# programming when focusing on working with data.
Book Chapter 12: “Sequence expressions and alternative workflows” explains how to work with in-memory data sets in F# using sequence expressions and higher-order functions.
Book Chapter 13: “Asynchronous and data-driven programming” shows how to use asynchronous workflows to obtain data from the Internet, how to convert data to a structured format, and how to chart it using Excel.
The following MSDN documents are related to the topic of this article:
Chart Controls is a MSDN section dedicated to working with Microsoft Chart Controls with many examples in C# and Visual Basic. It includes a comprehensive reference with all chart types and properties.
F# Charting Wrapper contains the download link as well as more resources about the FSharpChart library.
To download the code snippets shown in this article, go to http://code.msdn.microsoft.com/Chapter-6-Visualizing-Data-c68a2296
Previous article: Overview: Charting Libraries for F#
Next article: Tutorial: Getting Started with Microsoft Chart Controls