Is it possible in OxyPlot to colour the graph under the curve? And if it is then how? Just like this
This is my source:
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);
Thanks for any advice.
You can use an AreaSeries for this. An AreaSeries has two lists of points: Points for the upper edge and Points2 for the lower edge of an area. The area in between is filled with a color that you can specify using the Fill property. If no value is assigned for Points2, you can use this series to fill the area between the the x-axis and the points. You can also combine FunctionSeries with AreaSeries and use the first to calculate the points:
...
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);