FarNet.FSharp.Charting 2.0.1

Prefix Reserved
dotnet add package FarNet.FSharp.Charting --version 2.0.1                
NuGet\Install-Package FarNet.FSharp.Charting -Version 2.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FarNet.FSharp.Charting" Version="2.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FarNet.FSharp.Charting --version 2.0.1                
#r "nuget: FarNet.FSharp.Charting, 2.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install FarNet.FSharp.Charting as a Cake Addin
#addin nuget:?package=FarNet.FSharp.Charting&version=2.0.1

// Install FarNet.FSharp.Charting as a Cake Tool
#tool nuget:?package=FarNet.FSharp.Charting&version=2.0.1                

FarNet.FSharp.Charting

FarNet friendly FSharp.Charting extension

Package

The package is designed for FarNet.FSharpFar. To install FarNet packages, follow these steps.

The package is based on FSharp.Charting.

Features

In addition to the original FSharp.Charting features:

  • The library may be called from MTA threads.
  • Loop charts, often easier than live charts.
  • Chart windows are modeless by default.
  • Chart windows provide more options.
  • Timer helpers for live charts.

How to use

Instead of the original Chart.Show with a chart instance, use the new method Chart.Show with a function which creates and configures a chart.

Example, instead of the original method:

<data>
|> Chart.Line
|> Chart.Show

use this new:

fun () ->
    <data>
    |> Chart.Line
|> Chart.Show(title="My chart", ...)

The new method is slightly more verbose but it has some advantages:

  • It is modeless by default, the original is always modal.
  • It works well in Far Manager, unlike the original.
  • It provides handy features via parameters.
  • It may be called from MTA threads.

The original Chart.Show is still available and partially works in FarNet. It shows charts. But some features may not work, for example context menu commands "copy to clipboard", "save as", etc.

"Loop" and "Live" charts

There are two ways of showing charts with dynamic content: new loop charts and original live charts.

Loop charts are very easy, just specify the required timer interval as the parameter loop:

fun () ->
    <data>
    |> Chart.X
|> Chart.Show(loop=2000)

Live charts are slightly more difficult, they require input data as special streams of events or observables. If data do not naturally come from events then some conversion is needed. See the original manual for the details.

Unlike loop charts, live charts cannot change chart parameters dynamically.

Live charts are still useful:

  • Live charts may be more effective because only data change on updates.
  • Live charts provide useful incremental charts right out of the box.
  • Live charts are easier to code when data come from events.

If you accidentally (!) use live charts with loop shows then the result may be unexpected. But this is allowed and in some cases used effectively. See LoopLiveCharts.fsx

Timers for live charts

For generating live chart events you may use System.Windows.Forms.Timer or its handy helpers Timer.map and Timer.mapi. Important:

  • Timers and mappings must be created in chart making functions.
  • Do not use other timer classes like System.Timers.Timer.

Using with FSharpFar

In your script directory create the configuration *.fs.ini:

[use]
%FARHOME%\FarNet\Lib\FarNet.FSharp.Charting\FarNet.FSharp.Charting.ini

This is it. See /samples.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.1 325 1/17/2024
2.0.0 257 11/19/2023
1.0.1 569 1/1/2023
1.0.0 346 11/18/2022
0.2.1 483 7/31/2022
0.2.0 494 7/19/2022
0.1.2 398 3/6/2021
0.1.1 367 3/6/2021
0.1.0 455 6/17/2020
0.0.1 462 6/11/2020