From 755f95b1c70d9a431b09afc88200869cba8fd5b7 Mon Sep 17 00:00:00 2001 From: Derek Melchin <38889814+DerekMelchin@users.noreply.github.com> Date: Tue, 24 Oct 2023 16:57:27 -0600 Subject: [PATCH] Update 06 Plot Data.html --- .../06 Plot Data.html | 35 +++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/08 Drafts/04 Research Environment/03 Datasets/06 Equity Fundamental Data/06 Plot Data.html b/08 Drafts/04 Research Environment/03 Datasets/06 Equity Fundamental Data/06 Plot Data.html index 78e6de4047..b1c98ac402 100644 --- a/08 Drafts/04 Research Environment/03 Datasets/06 Equity Fundamental Data/06 Plot Data.html +++ b/08 Drafts/04 Research Environment/03 Datasets/06 Equity Fundamental Data/06 Plot Data.html @@ -2,24 +2,31 @@
Follow these steps to plot line charts using built-in methodsPlotly.NET
package:
var history = qb.GetFundamental(symbols, "ValuationRatios.PERatio", new DateTime(2014, 1, 1), new DateTime(2015, 1, 1));
history = qb.GetFundamental(symbols, "ValuationRatios.PERatio", datetime(2014, 1, 1), datetime(2015, 1, 1))
#r "../Plotly.NET.dll" +#r "../Plotly.NET.Interactive.dll" + +using Plotly.NET; +using Plotly.NET.Interactive; +using Plotly.NET.LayoutObjects;+
Line
charts.Line
objects for each Symbol
.var chart1 = Chart2D.Chart.Line<DateTime, decimal, string>( - history.Select(x => (DateTime)x.Time), - history.Select(x => (decimal)x[aapl]), - Name: "AAPL" -); -var chart2 = Chart2D.Chart.Line<DateTime, decimal, string>( - history.Select(x => (DateTime)x.Time), - history.Select(x => (decimal)x[goog]), - Name: "GOOG" +var charts = symbols.Select( + symbol => Chart2D.Chart.Line<DateTime, decimal, string>( + history.Select(x => (DateTime)x.Time), + history.Select(x => (decimal)x[symbol]), + Name: symbol.Value + ) );
Layout
to the chart.var chart = Plotly.NET.Chart.Combine(new []{chart1, chart2}); +var chart = Plotly.NET.Chart.Combine(charts); chart.WithLayout(layout);