ScottPlot多轴

右轴

新图的每一边都有一个轴。默认情况下,右侧和顶部的轴不可见。要使用右轴,请使其可见,然后告诉 plottable 使用它。

  

MultiAxis.cs

// plot data with very different scales
var sig1 = WpfPlot1.Plot.Add.Signal(Generate.Sin(mult: 0.01));
var sig2 = WpfPlot1.Plot.Add.Signal(Generate.Cos(mult: 100));

// tell each signal plot to use a different axis
sig1.Axes.YAxis = WpfPlot1.Plot.Axes.Left;
sig2.Axes.YAxis = WpfPlot1.Plot.Axes.Right;

// add additional styling options to each axis
WpfPlot1.Plot.Axes.Left.Label.Text = "Left Axis";
WpfPlot1.Plot.Axes.Right.Label.Text = "Right Axis";
WpfPlot1.Plot.Axes.Left.Label.ForeColor = sig1.Color;
WpfPlot1.Plot.Axes.Right.Label.ForeColor = sig2.Color;

WpfPlot1.Refresh();


多轴

可以将其他轴添加到绘图中。默认情况下,绘图表使用主轴的坐标系显示,但任何绘图表都可以使用任何 X 轴和 Y 轴显示。

  

MultiAxis.cs

// plottables use the standard X and Y axes by default
var sig1 = WpfPlot1.Plot.Add.Signal(Generate.Sin(51, mult: 0.01));
sig1.Axes.XAxis = WpfPlot1.Plot.Axes.Bottom; // standard X axis
sig1.Axes.YAxis = WpfPlot1.Plot.Axes.Left; // standard Y axis
WpfPlot1.Plot.Axes.Left.Label.Text = "Primary Y Axis";

// create a second axis and add it to the plot
var yAxis2 = WpfPlot1.Plot.Axes.AddLeftAxis();

// add a new plottable and tell it to use the custom Y axis
var sig2 = WpfPlot1.Plot.Add.Signal(Generate.Cos(51, mult: 100));
sig2.Axes.XAxis = WpfPlot1.Plot.Axes.Bottom; // standard X axis
sig2.Axes.YAxis = yAxis2; // custom Y axis
yAxis2.LabelText = "Secondary Y Axis";

WpfPlot1.Refresh();


仅右轴

默认 Y 轴是绘图左侧的轴,但可以使用右侧 Y 轴。

  

MultiAxis.cs

// add a plottable to the plot
var sig = WpfPlot1.Plot.Add.Signal(Generate.Sin());

// configure the plottable to use the right Y axis
sig.Axes.YAxis = WpfPlot1.Plot.Axes.Right;

// configure the grid to display ticks from the right Y axis
WpfPlot1.Plot.Grid.YAxis = WpfPlot1.Plot.Axes.Right;

// style the right axis as desired
WpfPlot1.Plot.Axes.Right.Label.Text = "Hello, Right Axis";
WpfPlot1.Plot.Axes.Right.Label.FontSize = 18;

// it is recommended to remove tick generators from unused axes
WpfPlot1.Plot.Axes.Left.RemoveTickGenerator();

// pass in the custom axis when calling SetLimits()
WpfPlot1.Plot.Axes.SetLimitsY(bottom: -2, top: 2, yAxis: WpfPlot1.Plot.Axes.Right);

WpfPlot1.Refresh();
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

code_shenbing

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值