| |||||
Introducing SharpPlot Your First Chart Recent Updates Tutorials General Tutorials Chart Tutorials Reference SharpPlot Class Properties Methods Structures Enumerations Style examples Glossaries Active Charts VectorMath Class DBUtil Class Get SharpPlot Download SharpPlot Buying SharpPlot SharpPlot Support Upgrading from GraPL Release notes |
Home > Sample Charts > MinMaxChart > Frost-free days as a TimeSpan Frost-free days as a TimeSpanSome 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 |