我正在尝试将基本折线图的 LiveCharts 示例转换为与 Elmish.Wpf 一起使用
除了“YFormatter”之外,我对所有东西都有绑定。我应该使用哪种绑定?
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" |> ?????
]
xaml 是根据基本折线图示例
<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>