Home > Sample Charts > MinMaxChart > Frost-free days as a TimeSpan

Frost-free days as a TimeSpan

Some data series are best represented by their range at each time-value. Temperature data is typical – here the most informative chart shows the maximum and minimum values by day, with the range drawn as a vertical line. This chart is also commonly used for stock-price data where the daily high and low may be combined with opening and closing values to produce a wide variety of typical ‘Wall Street Journal’ plots of the market data.

This time, a horizontal chart style is used so that the years are stacked vertically up the page.

This gives a clear picture of the ‘growing season’ from year to year. The arrowheads have been ‘customised’ a little here (the default shape is a little too fat) and an angled note is used to label the central region.


SharpPlot sp = new SharpPlot;

sp.SetMargins(12,20,24,12);

years = new int[] {89,90,91,92,93,94,95,96,97,98,99,0,1,2,3};
days = new int[] {31,29,31,30,31,30,31,31,30,31,30,31};
dmax = new int[] {324,294,293,288,333,309,313,298,291,279,305,309,292,295};
dmin = new int[] {108,118,95,107,108,118,97,127,106,108,106,130,109,102};

sp.SetXTickMarks(AE.Join(0,AE.SumScan(days)));
sp.XAxisStyle = XAxisStyles.GridLines|XAxisStyles.MiddleLabels|XAxisStyles.ForceZero;
sp.SetXLabels(new string[]{"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep",
         "Oct","Nov","Dec"});
sp.YAxisStyle = YAxisStyles.ForceZero|YAxisStyles.AtEndCaption;
sp.YCaption = "Year";
sp.YLabelFormat = "00";
sp.SetYLabels(years);
sp.SetYTickMarks(1);

sp.MinMaxChartStyle = MinMaxChartStyles.Horizontal|MinMaxChartStyles.ArrowLines|
         MinMaxChartStyles.Envelope;
sp.SetFillStyles(FillStyle.Opacity30);

sp.SetArrowStyle(7,20,FillStyle.Saturate80);

sp.DrawMinMaxChart(dmax,dmin);

sp.SetNoteFont("Arial",24,FontStyle.Bold,Color.White);
sp.DrawNote("Frost-free Days",170,2,65);

Worked Examples

minmaxchart1 minmaxchart2 minmaxchart3 minmaxchart4

Send comments on this topic
© Dyalog Ltd 2013