A
A
Alexander Prokopenko2022-02-08 15:45:02
C++ / C#
Alexander Prokopenko, 2022-02-08 15:45:02

How to fix MaxRenderIndex must be positive error in C# ScottPlot?

I have a database, with columns: Date time, CX, CY, CZ. I have a class that works with this database and now I want to draw a graph from this database (MySQL).

Here is my code:

DateTime start = new DateTime(1900, 1, 1);
List<double> dates = new List<double>();

List<SignalPlot> signalsX = new List<SignalPlot>();
List<SignalPlot> signalsY = new List<SignalPlot>();
List<SignalPlot> signalsZ = new List<SignalPlot>();

List<double> valuesX = new List<double>();
List<double> valuesY = new List<double>();
List<double> valuesZ = new List<double>();

List<string> listDates = new List<string>();
List<string> listX = new List<string>();
List<string> listY = new List<string>();
List<string> listZ = new List<string>();

listDates = DB.Select(ref conn, "Date time");
listX = DB.Select(ref conn, "CX");
listY = DB.Select(ref conn, "CY");
listZ = DB.Select(ref conn, "CZ");

for (int i = 0; i < listX.Count; i++)
{
valuesX.Add(double.Parse(listX[i]));
valuesY.Add(double.Parse(listY[i]));
valuesZ.Add(double.Parse(listZ[i]));
}

double samplesPerDay = (24 * 60); 

var sig = formsPlot1.Plot.AddSignal(valuesX.ToArray(), sampleRate: samplesPerDay);
sig.OffsetX = start.ToOADate();

formsPlot1.Plot.XAxis.DateTimeFormat(true);
formsPlot1.Refresh();


Line error:

Data like this: sig.OffsetX = start.ToOADate();
620265095fde3610230119.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question