c# OxyPlot 给曲线下的图着色

c# OxyPlot coloring the graph under the curve

OxyPlot 可以给曲线下的图着色吗? 如果是那么怎么办?就这样

这是我的来源:

PlotView myPlot = new PlotView();
// Create Plotmodel object          
var myModel = new PlotModel { Title = string.Format("{0}\n\r∫f(x) = ({1}x^3) + ({2}x^2) + ({3}x) + ({4}) = {5} \n\r{6} ", horniMez, koeficienty[3], koeficienty[2], koeficienty[1], koeficienty[0], integral, dolniMez )};
           
myModel.Series.Add(new FunctionSeries(x=>koeficienty[3]*x*x*x+koeficienty[2]*x*x+koeficienty[1]*x+ koeficienty[0], dolniMez, horniMez, 0.1, string.Format( "Funkce: ({0}x^3) + ({1}x^2) + ({2}x) + ({3})", koeficienty[3], koeficienty[2], koeficienty[1], koeficienty[0])));

// Assign PlotModel to PlotView
myPlot.Model = myModel;

//Set up plot for display
myPlot.Dock = System.Windows.Forms.DockStyle.Top;
myPlot.Location = new System.Drawing.Point(0, 0);
myPlot.Size = new System.Drawing.Size(700, 700);
myPlot.TabIndex = 0;
Controls.Add(myPlot);

感谢任何建议。

您可以为此使用 AreaSeries。 AreaSeries 有两个点列表:上边缘的 Points 和下边缘的 Points2。 中间的区域填充了您可以使用填充 属性 指定的颜色。如果没有为 Points2 分配值,则可以使用此系列填充 x-axis 和点之间的区域。 您还可以将 FunctionSeries 与 AreaSeries 结合使用,并使用第一个来计算点数:

...

FunctionSeries function = new FunctionSeries(x=>koeficienty[3]*x*x*x+koeficienty[2]*x*x+koeficienty[1]*x+ koeficienty[0], dolniMez, horniMez, 0.1, string.Format( "Funkce: ({0}x^3) + ({1}x^2) + ({2}x) + ({3})", koeficienty[3], koeficienty[2], koeficienty[1], koeficienty[0])));

AreaSeries areaSeries = new AreaSeries();
areaSeries.Points.AddRange(functionSeries.Points);
areaSeries.Color = OxyColors.Black;                      // upper line color
areaSeries.Color2 = OxyColors.Black;                     // lower line, i.e. y=0
areaSeries.Fill = OxyColor.FromArgb(64, 255, 228, 181);  // fill color between
areaSeries.StrokeThickness = 1;

myModel.Series.Add(areaSeries);