如何在 FSharp.Chartting 中设置不透明度和线条类型



我知道如何在FSharp.Charting中控制颜色,字体大小和网格线。但是有没有办法为线条颜色设置不透明度和/或将线条类型更改为虚线。

#load @"....FSLABpackagesFsLabFslab.fsx"
open FSharp.Charting
open System.Drawing
let rnd = System.Random()
rnd.NextDouble()
let rs = List.init 100 (fun _ -> rnd.NextDouble()-0.5)
let rs = rs |> List.scan (+) 0.
Chart.Line(rs) 
    .WithYAxis(MajorGrid = ChartTypes.Grid(Enabled=true,LineColor=Color.LightGray))
    .WithXAxis(MajorGrid = ChartTypes.Grid(Enabled=true,LineColor=Color.LightGray))

像这样:

.....
Chart.Line(rs,Name="randomwalk") 
    .WithYAxis(MajorGrid = ChartTypes.Grid(Enabled=true,LineColor=Color.LightGray))
    .WithXAxis(MajorGrid = ChartTypes.Grid(Enabled=true,LineColor=Color.LightGray))
    .ApplyToChart(fun x -> x.Series.["randomwalk"].BorderDashStyle <- System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Dash)
    .ApplyToChart(fun x -> x.Series.["randomwalk"].Color <- Color.FromArgb(127, Color.Red))

将图表randomwalk线条样式设置为ChartDashStyle.Dash,将颜色设置为半透明Color.Red

相关内容

  • 没有找到相关文章

最新更新