how to plot multiple lines in same chart or plot the chart with 2 graphs side by side
i would like to plot two indicator lines on same chart or show the charts side by side. the current example i put here shows 2 charts in 2 different tabs. how can i fix it?
void Main() { string json1 = "[\r\n {\r\n \"entryTime\": \"2019-01-08T00:00:01\",\r\n \"gains\": -0.00071,\r\n \"cumulativegains\": -0.00071\r\n },\r\n {\r\n \"entryTime\": \"2019-01-08T05:00:01\",\r\n \"gains\": -0.00102,\r\n \"cumulativegains\": -0.00102\r\n },\r\n {\r\n \"entryTime\": \"2019-01-08T09:00:01\",\r\n \"gains\": -0.00113,\r\n \"cumulativegains\": -0.00113\r\n },\r\n {\r\n \"entryTime\": \"2019-01-08T10:31:19\",\r\n \"gains\": -0.00236,\r\n \"cumulativegains\": -0.00236\r\n },\r\n {\r\n \"entryTime\": \"2019-01-09T20:21:34\",\r\n \"gains\": -0.00262,\r\n \"cumulativegains\": -0.00262\r\n },\r\n {\r\n \"entryTime\": \"2019-01-11T16:00:01\",\r\n \"gains\": -0.00075,\r\n \"cumulativegains\": -0.00075\r\n },\r\n ]"; string json2="[\r\n {\r\n \"entryTime\": \"2019-01-02T05:00:01\",\r\n \"gains\": 0.00591,\r\n \"cumulativegains\": 0.00591\r\n },\r\n {\r\n \"entryTime\": \"2019-01-03T10:00:01\",\r\n \"gains\": 0.00139,\r\n \"cumulativegains\": 0.00139\r\n },\r\n {\r\n \"entryTime\": \"2019-01-04T08:30:02\",\r\n \"gains\": -0.00434,\r\n \"cumulativegains\": -0.00434\r\n },\r\n {\r\n \"entryTime\": \"2019-01-07T23:00:01\",\r\n \"gains\": -0.00172,\r\n \"cumulativegains\": -0.00172\r\n },\r\n {\r\n \"entryTime\": \"2019-01-08T05:00:01\",\r\n \"gains\": -0.00096,\r\n \"cumulativegains\": -0.00096\r\n },\r\n {\r\n \"entryTime\": \"2019-01-08T08:00:01\",\r\n \"gains\": -0.00048,\r\n \"cumulativegains\": -0.00048\r\n },\r\n {\r\n \"entryTime\": \"2019-01-08T14:00:01\",\r\n \"gains\": -0.00037,\r\n \"cumulativegains\": -0.00037\r\n },\r\n {\r\n \"entryTime\": \"2019-01-09T09:00:01\",\r\n \"gains\": -0.00169,\r\n \"cumulativegains\": -0.00169\r\n }\r\n]"; List<trades2plot> jsonData1 = JsonConvert.DeserializeObject<List<trades2plot>>(json1); List<trades2plot> jsonData2 = JsonConvert.DeserializeObject<List<trades2plot>>(json2); jsonData1.Chart(c => c.entryTime, c => c.cumulativegains, Util.SeriesType.Line).Dump(); jsonData2.Chart(c => c.entryTime, c => c.cumulativegains, Util.SeriesType.Line).Dump(); } public class trades2plot { public DateTime entryTime; public double gains; public double cumulativegains; public trades2plot() { } } // You can define other methods, fields, classes and namespaces here
Comments
To display two charts side-by-side, use Util.HorizontalRun:
To join the charts together, you will need to do a union. Something like this:
wow. i understand the first example. the second example is bit too complex for me. is there any reference material that i can read to understand it better
The union is just to get the series onto the same x-axis. You can see what it's doing by dumping the union variable.