Carl Nolan’s ramblings on development
The new version of FSharp.Chart (formely FSharpChart) can now be found on GitHib at: http://fsharp.github.io/FSharp.Charting/
If you have been using FSharpChart you will have seen some recent activities around documentation. I am happy to say that a new code drop has been made available. This release deals with some minor bug fixes and restructures the code download, hopefully making it easier to navigate, in addition to the following changes:
First and foremost as a reminder the code can be downloaded from here:
Before drilling down into the code changes it is worth mentioning the new code structure. Hopefully this will make it simpler in navigating the source and samples. The folders and file contents for the download are:
As some folks have expressed a desire to have charts rendered using more modern fonts, the code now contains a default font:
When defining a Font the normal definition is as follows:
However, with the definition of a default Font it makes sense to allow one to define a new Font where one expresses the differences to the default Font. Thus a StyleHelper method has been provided allowing one to write:
Within the provided FSharpChart samples there are often times where one has to define a LabelStyle, Title, or Legend. These elements all support fonts to be defined. To simplify this process a series of StyleHelper methods are available where one can also just express the Font characteristic that differs from the default. The definition for these helpers is:
This allows code such as:
Hopefully folks this is an easier syntax for Titles, Legends, LabelStyles, and Fonts.
In allowing the modification of all chart Font properties to use the newly defined default a mechanism was defined that allowed any chart property to be overridden with a default. Thus the code now supports the ability to specify a default value for any property which can be restricted to either a particular type (such as Series or Label) or to a particular chart type.
To demonstrate this I have defined a few simple properties that folks have requested:
Hopefully this will allow folks to customize FSharpChart with a set of defaults that render charts with desirable visuals.
Last but not least ToolTip’s have now been defined for DataPoint’s on a chart.
Support for these ToolTips are provided in several ways.
Firstly these ToolTips are enabled by default with a specific default ToolTip being defined for each chart type:
This ability is supported through the Series ToolTip property. A good set of documentation is available in the charting Technical Reference:
The Keywords section covers the syntax for the property and the Chart Types section defines what values can and should be used.
Finally, the DataPoint properties for a Series can now be specified using the WithSeries.DataPoint method:
The supported properties that can be defined are Label, LabelToolTip, and ToolTip.
Hopefully folks will find these enhancements useful; the ToolTip support having been a highly requested feature. As always please do let me know if there are features that you would like to be included in FSharpChart.