-
Notifications
You must be signed in to change notification settings - Fork 981
Closed
Labels
Description
The Generate.RandomOHLCs generates dates for the year 1900. Please change it to the current year.
My test code is:
using ScottPlot;
namespace ScottPlotBug;
public partial class Form1 : Form
{
ScottPlot.WinForms.FormsPlot? formsPlot;
public Form1()
{
InitializeComponent();
DrawCandleChart("MARA", 100);
}
public void DrawCandleChart(string symbol, int n)
{
string version = ScottPlot.Version.VersionString;
if (version != "5.0.19")
{
throw new InvalidOperationException($"ScottPlot was expected to be 5.0.19 but is actually {version}");
}
if (string.IsNullOrEmpty(symbol)) { return; }
formsPlot = new() { Dock = DockStyle.Fill }; // Add a formsPlot to formsPlotPanel
formsPlotPanel.Controls.Add(formsPlot);
formsPlot.Plot.ScaleFactor = 2;
formsPlot.Plot.Clear();
formsPlot.Refresh();
var ohlcData = Generate.RandomOHLCs(n);
var candlePlot = formsPlot.Plot.Add.Candlestick(ohlcData);
candlePlot.Axes.YAxis = formsPlot.Plot.Axes.Right;
candlePlot.Sequential = true; // Omit gaps
formsPlot.Plot.Axes.DateTimeTicks(Edge.Bottom);
formsPlot.Plot.Axes.Bottom.Label.Text = symbol;
formsPlot.Plot.Axes.Bottom.Label.FontName = "Verdana";
formsPlot.Plot.Axes.Bottom.Label.Bold = false;
formsPlot.Plot.Axes.Bottom.Label.FontSize = 12;
formsPlot.Plot.Axes.AutoScale();
formsPlot.Refresh();
}
}Charles
Reactions are currently unavailable
