-
Notifications
You must be signed in to change notification settings - Fork 981
Closed
Description
Issue:
I don't understand why this code throws an error.
ScottPlot Version:
ScottPlot 5.0.43
using ScottPlot;
namespace ScottPlot_test3;
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
DrawCandleChart("AAL", 4);
}
#region DrawCandleChart
public void DrawCandleChart(string symbol, int n)
{
var date1 = new DateTime(2024, 11, 1, 16, 0, 0); // 4:00 PM in New York
var date2 = new DateTime(2024, 11, 4, 16, 0, 0);
var date3 = new DateTime(2024, 11, 5, 16, 0, 0);
var date4 = new DateTime(2024, 11, 6, 16, 0, 0);
var timeSpan = new TimeSpan(1, 0, 0, 0); // 1 day
var ohlcList1 = new List<OHLC>
{
new OHLC(13.470, 13.400, 13.660, 13.550, date1, timeSpan),
new OHLC(13.500, 12.960, 13.500, 13.000, date2, timeSpan),
new OHLC(12.950, 12.930, 13.220, 13.190, date3, timeSpan),
new OHLC(14.010, 13.795, 14.160, 14.000, date4, timeSpan),
};
var candlePlot = formsPlot.Plot.Add.Candlestick(ohlcList1);
formsPlot1.Plot.Axes.AutoScale();
formsPlot1.Refresh();
}
}Here is the Stack Trace:
System.ArgumentException
HResult=0x80070057
Message=Argument $min must be less than or equal to $max.
Source=ScottPlot
StackTrace:
at ScottPlot.Range..ctor(Double min, Double max)
at ScottPlot.DataSources.OHLCSourceBase.<>c.<GetLimitsY>b__3_0(OHLC x)
at System.Linq.Utilities.<>c__DisplayClass2_0`3.<CombineSelectors>b__0(TSource x)
at System.Linq.Enumerable.SelectListIterator`2.MoveNext()
at System.Linq.Enumerable.MinFloat[T](IEnumerable`1 source)
at ScottPlot.DataSources.OHLCSourceBase.GetLimitsY()
at ScottPlot.DataSources.OHLCSourceBase.GetLimits()
at ScottPlot.Plottables.CandlestickPlot.GetAxisLimits()
at ScottPlot.AutoScalers.FractionalAutoScaler.AutoScaleAll(IEnumerable`1 plottables)
at ScottPlot.AxisManager.AutoScale(Nullable`1 invertX, Nullable`1 invertY)
at ScottPlot_test3.Form1.DrawCandleChart(String symbol, Int32 n) in H:\HedgeTools\source\Tests\ScottPlot_Data_Gaps_Candlestick\Form1.cs:line 36
at ScottPlot_test3.Form1..ctor() in H:\HedgeTools\source\Tests\ScottPlot_Data_Gaps_Candlestick\Form1.cs:line 13
at ScottPlot_test3.Program.Main() in H:\HedgeTools\source\Tests\ScottPlot_Data_Gaps_Candlestick\Program.cs:line 9
Any help will be greatly appreciated.
Charles
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels