Home > Sample Charts > TraceChart > Several Parallel Timeseries

Several Parallel Timeseries

Trace charts are a slightly specialist style of plot, originally designed for data from devices like seismographs and EEGs where multiple pens trace out (almost) parallel lines. Each pen is allocated a tickmark on the Y-axis and then an ‘inner axis’ is created for it (naturally these inner axes are all scaled identically).

This chart takes the ‘delta’ of three popular stock prices and shows the daily volatility of each. Note that both BP and the Halifax Bank show the spike around day-50 (the invasion of Iraq) but Kelda (a utility stock) was completely unaffected.

If the series tend to move very closely together, you can set the Inner-axis range to quite a big number (say 1.8) to allow each series to stray into the band occupied by its neighbours. This would be typical of a multiple pen-plotter such as a seismograph.


SharpPlot sp = new SharpPlot;

sp.Heading = "Daily Volatility of 3 Stock Prices";

bp = VectorMath.Difference(new int[] {427,428,427,429,424,418,420,424,416,410,406,
         409,403,395,389,380,374,369,356,362,383,383,382,393,386,398,382,379,380,
         394,385,381,388,396,404,393,400,413,417,414,402,400,400,408,408,406,405,
         395,392,395,371,392,400,415,413,414,417,428,416,422,429,416,414,401,416,
         406,407,416,421,411,412,406,405,408,414,407,408,414,412,406,395,403,400,
         397,395,405,411,414,408,416,416,407,413,414,408,414,410,418,415,424,428,
         424,418,428,430,436,430,430,429,432,439,446,439,438,433,438,429,434,431,
         428,424,420,424,420,412,412,410,412,418,414,410,404,407,410,404,405,411,
         415,415,419,419,423,416,423,420,423,426,422,428,421,425,436,442,439,433,
         440,436,442,437,435,432,436,437,429,437,448,448,442,450,442,441,443,439,
         436,440,438,429,422,423,419,423,426,415,415,413,422,420,429,432,432,430,
         435,434,442,435,433,426,426,425,421});
kelda = VectorMath.Difference(new int[] {424,420,418,421,429,440,426,427,419,413,
         415,421,428,428,424,429,411,408,399,403,400,400,402,404,404,412,416,411,
         421,426,423,420,413,419,418,423,428,428,437,434,424,416,410,426,422,422,
         420,410,411,414,408,413,404,409,408,401,408,400,390,381,407,412,410,410,
         408,425,413,415,418,419,420,416,419,425,423,419,422,425,424,416,411,411,
         414,411,408,412,416,415,408,414,419,421,426,430,420,432,425,437,436,437,
         445,436,434,440,440,436,438,435,433,430,427,427,428,429,433,426,428,426,
         423,430,432,426,424,427,430,427,428,427,429,430,426,429,430,430,430,428,
         431,429,430,442,440,442,441,435,435,439,441,440,442,436,438,429,432,432,
         436,438,438,437,443,442,419,419,412,410,404,410,408,406,408,409,412,413,
         414,415,418,418,420,416,420,431,429,435,429,425,423,428,423,424,428,430,
         428,428,423,428,426,426,423,425,427,430});
hbos = VectorMath.Difference(new int[] {655,672,665,659,642,639,638,647,638,647,627,
         629,618,602,589,574,558,578,563,549,538,556,551,589,567,592,581,592,566,
         581,589,600,590,616,619,600,602,596,589,621,638,625,662,668,660,651,651,
         626,608,612,563,598,626,641,652,668,654,690,675,674,684,670,659,650,663,
         672,688,690,720,700,698,691,694,714,737,716,722,739,749,738,726,744,740,
         733,713,737,725,706,707,702,694,699,714,728,715,718,714,708,690,694,721,
         735,723,740,744,750,747,760,762,760,787,790,791,792,806,812,789,805,795,
         806,807,804,793,784,772,785,781,774,793,800,778,766,780,794,796,772,766,
         762,751,765,768,786,786,798,795,792,775,772,769,752,748,748,754,746,733,
         744,750,747,728,717,716,721,718,704,722,730,725,717,722,732,730,717,716,
         720,732,737,738,717,708,718,705,698,692,694,688,716,724,724,716,720,715,
         727,736,750,748,744,735,736,742,740});

sp.YAxisStyle = YAxisStyles.GridLines;
sp.IAxisStyle = IAxisStyles.PlainAxis;

sp.SetYLabels(new string[]{"Kelda","BP","HBOS"});
sp.IAllowance = 1.5;
sp.IIntercept = 0;

trace = new int[][]{kelda,bp,hbos};
sp.DrawTraceChart(trace);

Worked Examples

tracechart1 tracechart2 tracechart3 tracechart4

Send comments on this topic
© Dyalog Ltd 2013