[英]how to set opacity and line type in FSharp.Charting
I know how to control color, fontsize and gridlines in FSharp.Charting. 我知道如何在FSharp.Charting中控制颜色,字体大小和网格线。 But is there way to set opacity for a line color and/or change the line type to dashed for example.
但是有没有办法设置线条颜色的不透明度和/或将线条类型更改为虚线。
#load @"..\..\FSLAB\packages\FsLab\Fslab.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))
Something like this: 像这样:
.....
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))
will set the chart randomwalk
line style to ChartDashStyle.Dash
and color to semi-transparent Color.Red
. 会将图表
randomwalk
线型设置为ChartDashStyle.Dash
,将颜色设置为半透明的Color.Red
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.