How to: Create Standard Charts in F#
Applies to: Functional Programming
Published: January 2010
Summary: This section contains numerous ready to use snippets that construct common types of charts in F#.
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.
This section contains numerous examples of creating charts in F#. Each of the How To topics contains two versions of code with several variations. One version uses the FSharpChart library that is available as a free download. The second version uses the .NET Chart Controls directly. For more information about the two approaches as well as other technologies for drawing charts in F# visit the following page:
This article shows how to create bar and column charts in F#. The example visualizes the size of the populations of the continents.
This article shows how to create pie and doughnut charts in F#. The example visualizes the proportion of seats taken by individual parties in UK general elections.
This article shows how to create line and point charts in F#. The example draws a graph of a function, creates a scatter plot and draws a 2D spline defined by a function.
This article shows how to create stock and candlestick charts to visualize financial data in F#. It looks at how to draw charts, use dates as labels and how to specify the range of a chart.
This article shows how to create boxplot diagrams in F#. It looks at how to create a single boxplot from six statistics about an observation set as well as how to automatically create boxplots from observations.
The examples in this section demonstrate how to create charts using the FSharpChart library as well as using the .NET Chart Controls directly. The following resources provide more information about the F# library:
The .NET Chart Controls library is mainly useful when creating charts as part of a Windows Forms application or when developing a charting library with some special features. For more information about using Chart Controls directly see:
To download the code snippets shown in this article, go to http://code.msdn.microsoft.com/Chapter-6-Visualizing-Data-c68a2296
This article is based on 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.