I am trying to convert the LiveCharts example for a Basic Line Chart to use with Elmish.Wpf
I have bindings for everything except the "YFormatter". What sort of Binding should I use?
type Model = {
AllSeries: SeriesCollection
Labels: string[]
Formatter: ???
}
let init() = (
AllSeries =
let series = new SeriesCollection()
series.Add(new LineSeries(Title="S1", Values=new ChartVAlues<int>(seq {4; 6; 5})))
series
Labels = [| "Jan"; "Feb"; "Mar" |]
Formatter = ???
}
let bindings () : Binding<Model, MessageType> list = [
"AllSeries" |> Binding.oneWay(fun m -> m.AllSeries)
"Labels" |> Binding.oneWay(fun m-> m.Labels)
"YFormatter" |> ?????
]
The xaml is as per the Basic Line Chart example
<lvc:CartesianChart Series="{Binding AllSeries}">
<lvc:CartesianChart.AxisY>
<lvc:Axis Title="Sales" LabelFormatter="{Binding YFormatter}"></lvc:Axis>
</lvc:CartesianChart.AxisY>
<lvc:CartesianChart.AxisX>
<lvc:Axis Title="Month" Labels="{Binding Labels}"></lvc:Axis>
</lvc:CartesianChart.AxisX>
</lvc:CartesianChart>
Got it to work
The Model does not need "Formatter" at all
so, init has nothing to do
bindings has