-
Notifications
You must be signed in to change notification settings - Fork 1
Polyline
Polyline is one of the plot types that can be added to the chart.
To create a polyline you need two series: Xcoords: float seq and Ycoords: float seq which define the points that form the polyline.
let polyline = createPolyline Xcoords YcoordsActually the polyline is a record of type FSharpIDD.Plots.Polyline.Plot
You can also create it by explicitly filling up all record fields:
{
/// Specifies how to annotate the polyline in the legend. Null means that name is not set
Name: string
/// Series of X coords of the points that form the polyline
X: DataSeries
/// Series of Y coords of the points that form the polyline
Y: DataSeries
/// The fill colour of the polyline
Colour: Colour.Colour
/// The line thickness of the polyline in pixels
Thickness: float
/// The cap (shape of ending) of the line
LineCap: LineCap
/// The shape of joins of polyline's strait segments
LineJoin: LineJoin
}The polyline has five appearance options that can be configured:
- Name (as it's seen in a legend)
- Stroke colour
- Line thickness (in pixels)
- Line cap
- Line join
You can use the following functions of module FSharpIDD.Plots.Polyline to define the options respectively:
setName: name:string -> polyline:Plot -> PlotsetStrokeColour: colour:Colour.Colour -> polyline:Plot -> PlotsetThickness: thickness:Float -> polyline:Plot -> PlotsetLineCap: lineCap:CapType -> polyline:Plot -> PlotsetLineJoin: lineJoin:LineJoin -> polyline:Plot -> Plot
let curve2 =
createPolyline Xseries Yseries2
|> setName "Curve 2"
|> setStrokeColour Colour.Green
|> setThickness 10.0 There is also an option to set several of the appearance options with a single setOptions: options:Options -> polyline:Plot -> Plot call.
The convenience of the method is that you can define several but not necessary all options during Options value creation.
let options = Options(Name = "Curve 1", Thickness = 30.0, LineCap=LineCap.Round)
let curve1 =
createPolyline Xseries Yseries1
|> setOptions options