@@ -2180,6 +2180,91 @@ public static PlotModel ZeroCrossingQuadrantAxes()
21802180 return plot ;
21812181 }
21822182
2183+ [ Example ( "#1524: HitTracker IndexOutOfRangeException with HeatMapSeries" ) ]
2184+ public static PlotModel HitTrackerIndexOutOfRangeExceptionWithHeatMapSeries ( )
2185+ {
2186+ List < string > xAxisLabels = new List < string > ( ) { "1" , "2" , "3" , "4" , "5" , "1" , "2" , "3" , "4" , "5" } ;
2187+ List < string > yAxisLabels = new List < string > ( ) { "1" , "2" , "3" , "4" , "5" , "1" , "2" , "3" , "4" , "5" } ;
2188+
2189+ var plot = new PlotModel ( ) { Title = "Place the tracker to the far top or right of the series\n with a small window size." } ;
2190+
2191+ List < OxyColor > jetTransparent = new List < OxyColor > ( ) ;
2192+ foreach ( var item in OxyPalettes . Jet ( 1000 ) . Colors )
2193+ {
2194+ jetTransparent . Add ( OxyColor . FromAColor ( 220 , item ) ) ;
2195+ }
2196+ OxyPalette myPalette = new OxyPalette ( jetTransparent ) ;
2197+
2198+ plot . PlotAreaBackground = OxyColors . White ;
2199+ plot . DefaultFontSize = 14 ;
2200+ //plotModel.DefaultColors = SeriesColors;
2201+ plot . Padding = new OxyThickness ( 0 ) ;
2202+ plot . TitlePadding = 0 ;
2203+
2204+
2205+ plot . Axes . Add ( new CategoryAxis
2206+ {
2207+ Position = AxisPosition . Bottom ,
2208+ Key = "HorizontalAxis" ,
2209+ ItemsSource = xAxisLabels ,
2210+ MajorGridlineColor = OxyColors . Black ,
2211+ MajorGridlineStyle = LineStyle . Solid ,
2212+ IsZoomEnabled = false ,
2213+ IsPanEnabled = false ,
2214+ Angle = - 45 ,
2215+ FontSize = 14 ,
2216+ TitleFontSize = 14 ,
2217+ AxisTitleDistance = 0
2218+ } ) ;
2219+
2220+ plot . Axes . Add ( new CategoryAxis
2221+ {
2222+ Position = AxisPosition . Left ,
2223+ Key = "VerticalAxis" ,
2224+ ItemsSource = yAxisLabels ,
2225+ MajorGridlineColor = OxyColors . Black ,
2226+ MajorGridlineStyle = LineStyle . Solid ,
2227+ IsZoomEnabled = false ,
2228+ IsPanEnabled = false ,
2229+ FontSize = 14 ,
2230+ TitleFontSize = 14
2231+ } ) ;
2232+
2233+ // Color axis
2234+ plot . Axes . Add ( new LinearColorAxis ( )
2235+ {
2236+ Palette = myPalette ,
2237+ } ) ;
2238+
2239+ var rand = new Random ( ) ;
2240+ var data = new double [ yAxisLabels . Count , xAxisLabels . Count ] ;
2241+ for ( int x = 0 ; x < xAxisLabels . Count ; ++ x )
2242+ {
2243+ for ( int y = 0 ; y < yAxisLabels . Count ; ++ y )
2244+ {
2245+ data [ y , x ] = rand . Next ( 0 , 200 ) * ( 0.13876876848794587508758879 * ( y + 1 ) ) ;
2246+ }
2247+ }
2248+
2249+ var heatMapSeries = new HeatMapSeries
2250+ {
2251+ X0 = 0 ,
2252+ X1 = xAxisLabels . Count - 1 ,
2253+ Y0 = 0 ,
2254+ Y1 = yAxisLabels . Count - 1 ,
2255+ XAxisKey = "HorizontalAxis" ,
2256+ YAxisKey = "VerticalAxis" ,
2257+ RenderMethod = HeatMapRenderMethod . Bitmap ,
2258+ Interpolate = true ,
2259+ Data = data ,
2260+ TrackerFormatString = "{3}: {4}\n {1}: {2}\n {5}: {6:N1}%" ,
2261+ } ;
2262+
2263+ plot . Series . Add ( heatMapSeries ) ;
2264+
2265+ return plot ;
2266+ }
2267+
21832268 private class TimeSpanPoint
21842269 {
21852270 public TimeSpan X { get ; set ; }
0 commit comments