FSharp Charting更改数据点标签字体大小

时间:2017-06-15 09:04:17

标签: charts f# fsharpchart

使用F#Charting我可以用

更改轴标签字体大小
    chart |> Chart.WithArea.AxisX(LabelStyle = myStyle)

但是没有找到更改数据点标签字体大小的方法

    let myChart = Chart.Line prices |> Chart.WithDataPointLables(Label = "hello")

如上创建。

知道如何解决这个问题吗?

1 个答案:

答案 0 :(得分:3)

This doesn't seem to be supported directly FSharp.Charting but the library does provide a hole through its abstraction so you can access the underlying chart representation and do whatever you want to it. Assuming that you're running this on Windows with System.Windows.Forms.DataVisualization, which the library uses by default, then you can do this:

open FSharp.Charting

Chart.Line [1; 2; 3]
|> Chart.WithDataPointLabels(Label = "hello")
|> fun c -> c.ApplyToChart(fun c ->
    c.Series.[0].Font <- System.Drawing.Font("Verdana", float32 28))