0

让我们看最基本的代码:

int pointCount = 10000;
double[] x = DataGen.Consecutive(pointCount);
double[] sin = DataGen.Sin(pointCount);
double[] cos = DataGen.Cos(pointCount);

WpfPlot1.Plot.AddScatter(x, sin);
WpfPlot1.Plot.AddScatter(x, cos);
<WpfPlot Name="WpfPlot1" />

它将在一张图表上生成两个图。

而且我不知道如何隐藏特定的情节,例如第一个情节。这里似乎没有开箱即用的功能,所以你必须自己添加一些按钮,但我什至找不到任何隐藏它的功能。文档中的零信息。

4

1 回答 1

0

您想使用该IsVisible字段。它在这里列出:https ://swharden.com/scottplot/cookbooks/4.1.13-beta/api/plottable/scatterplot/#isvisible

该文档不存在,但IsVisible您认为它是。

你的代码变成了这样:

int pointCount = 10000;
double[] x = DataGen.Consecutive(pointCount);
double[] sin = DataGen.Sin(pointCount);
double[] cos = DataGen.Cos(pointCount);

var plot1 = WpfPlot1.Plot.AddScatter(x, sin);
var plot2 = WpfPlot1.Plot.AddScatter(x, cos);

plot1.IsVisible = false; // Hide plot1
plot1.IsVisible = true; // Show plot1
于 2021-05-10T17:22:51.207 回答