@@ -37,12 +37,15 @@ internal class StatsGraph
3737 public double GraphWidth { get ; private set ; }
3838 public float TextSize { get ; private set ; }
3939 public float TextSizeMsg { get ; private set ; }
40+ public double GameTypeDivisor { get ; private set ; }
4041
41- internal StatsGraph ( double width = 3840 , float textSize = 140 , float textSizeMsg = 100 )
42+ internal StatsGraph ( double width = 3840 , float textSize = 140 , float textSizeMsg = 100 , int gameModesPlayed = 0 )
4243 {
43- TextSize = textSize ;
44- TextSizeMsg = textSizeMsg ;
44+ GameTypeDivisor = ( 4 - ( gameModesPlayed == 0 ? 3 : gameModesPlayed ) ) ;
45+ TextSize = textSize / ( float ) GameTypeDivisor ;
46+ TextSizeMsg = textSizeMsg / ( float ) GameTypeDivisor ;
4547 GraphWidth = width ;
48+
4649
4750 font = new ( FontFamily . ResolveFontFamily ( FontFamily . StandardFontFamilies . TimesRoman ) , TextSize ) ;
4851 fontMessage = new ( FontFamily . ResolveFontFamily ( FontFamily . StandardFontFamilies . TimesItalic ) , TextSizeMsg ) ;
@@ -52,7 +55,7 @@ private Document CreateDocument(double height)
5255 {
5356 Document doc = new ( ) ;
5457 doc . Pages . Add ( new ( GraphWidth , height ) ) ;
55-
58+
5659 LinearGradientBrush bkgBrush = new ( new Point ( 0 , 0 ) ,
5760 new Point ( GraphWidth , height ) ,
5861 new GradientStop ( COL_BKG_GRAD_START , 0 ) ,
@@ -105,6 +108,8 @@ internal async Task<string> RenderCapsGraph(List<CapsRecord> capsScoresWhite, Li
105108 {
106109 return await Task < string > . Run ( ( ) =>
107110 {
111+ height /= GameTypeDivisor ;
112+
108113 //Make sure the data is sorted correctly
109114 capsScoresWhite = capsScoresWhite . OrderBy ( item => item . GameDate ) . TakeLast ( ( int ) maxCapsGames ) . ToList ( ) ;
110115 capsScoresBlack = capsScoresBlack . OrderBy ( item => item . GameDate ) . TakeLast ( ( int ) maxCapsGames ) . ToList ( ) ;
@@ -162,12 +167,12 @@ internal async Task<string> RenderCapsGraph(List<CapsRecord> capsScoresWhite, Li
162167
163168 GraphicsPath gpWhiteSmooth = new ( ) ;
164169 _ = gpWhiteSmooth . AddSmoothSpline ( gpWhitePoints . ToArray ( ) ) ;
165- gpr . StrokePath ( IS_SMOOTH_CAPS ? gpWhiteSmooth : gpWhite , COL_CAPS_WHITE , lineWidth : GRAPH_LINE_WIDTH ) ;
170+ gpr . StrokePath ( IS_SMOOTH_CAPS ? gpWhiteSmooth : gpWhite , COL_CAPS_WHITE , lineWidth : GRAPH_LINE_WIDTH / GameTypeDivisor ) ;
166171
167172
168173 GraphicsPath gpBlackSmooth = new ( ) ;
169174 _ = gpBlackSmooth . AddSmoothSpline ( gpBlackPoints . ToArray ( ) ) ;
170- gpr . StrokePath ( IS_SMOOTH_CAPS ? gpBlackSmooth : gpBlack , COL_CAPS_BLACK , lineWidth : GRAPH_LINE_WIDTH ) ;
175+ gpr . StrokePath ( IS_SMOOTH_CAPS ? gpBlackSmooth : gpBlack , COL_CAPS_BLACK , lineWidth : GRAPH_LINE_WIDTH / GameTypeDivisor ) ;
171176
172177 WriteMessage ( gpr , height , $ "* Based on the last { whiteMovingAv . Length } /{ blackMovingAv . Length } games with available CAPs scores") ;
173178 }
@@ -181,6 +186,7 @@ internal async Task<string> RenderAllCapsGraph(List<CapsRecord> capsScores, doub
181186 {
182187 return await Task < string > . Run ( ( ) =>
183188 {
189+ height /= GameTypeDivisor ;
184190 Document doc = CreateDocument ( height ) ;
185191 VectSharp . Graphics gpr = doc . Pages [ 0 ] . Graphics ;
186192
@@ -229,11 +235,12 @@ internal async Task<string> RenderAllCapsGraph(List<CapsRecord> capsScores, doub
229235 } ) . ConfigureAwait ( false ) ;
230236 }
231237
232- internal async Task < string > RenderRatingGraph ( List < ( DateTime gameDate , int rating ,
233- string gameType ) > ratingsPostGame , double height = 1920 )
238+ internal async Task < string > RenderRatingGraph ( List < ( DateTime gameDate , int rating , string gameType ) > ratingsPostGame ,
239+ double height = 1920 )
234240 {
235241 return await Task < string > . Run ( ( ) =>
236242 {
243+ height /= GameTypeDivisor ;
237244 Document doc = CreateDocument ( height ) ;
238245 VectSharp . Graphics gpr = doc . Pages [ 0 ] . Graphics ;
239246
@@ -283,8 +290,8 @@ internal async Task<string> RenderRatingGraph(List<(DateTime gameDate, int ratin
283290
284291 WriteRangeMessage ( gpr , height , $ "{ graphMin } ", $ "{ graphMax } ") ;
285292
286- gpr . FillRectangle ( 0 , ( ( graphMax - ratingsPostGameOrdered [ ^ 1 ] . rating ) * RatingStepY ) - ( CUR_RATING_BAR_HEIGHT / 2 ) ,
287- GraphWidth , CUR_RATING_BAR_HEIGHT ,
293+ gpr . FillRectangle ( 0 , ( ( graphMax - ratingsPostGameOrdered [ ^ 1 ] . rating ) * RatingStepY ) - ( ( CUR_RATING_BAR_HEIGHT / GameTypeDivisor ) / 2 ) ,
294+ GraphWidth , CUR_RATING_BAR_HEIGHT / GameTypeDivisor ,
288295 COL_RATING ) ;
289296 }
290297
@@ -293,11 +300,13 @@ internal async Task<string> RenderRatingGraph(List<(DateTime gameDate, int ratin
293300 } ) . ConfigureAwait ( false ) ;
294301 }
295302
296- internal async Task < string > RenderAverageStatsGraph ( List < ( string TimeControl , int VsMin , int Worst , int LossAv , int DrawAv ,
297- int WinAv , int Best , int VsMax ) > graphData , double height = 1280 )
303+ internal async Task < string > RenderAverageStatsGraph ( List < ( string TimeControl , int VsMin , int Worst , int LossAv , int DrawAv , int WinAv , int Best , int VsMax ) > graphData ,
304+ double height = 1280 )
298305 {
299306 return await Task < string > . Run ( ( ) =>
300307 {
308+ height /= ( ( double ) GameTypeDivisor ) ;
309+
301310 int graphMinCalc = graphData . Where ( x => x . WinAv != 0 && x . LossAv != 0 ) . Select ( x => x . WinAv ) . DefaultIfEmpty ( 0 ) . Min ( ) ;
302311 int graphMaxCalc = graphData . Where ( x => x . WinAv != 0 && x . LossAv != 0 ) . Select ( x => x . LossAv ) . DefaultIfEmpty ( 0 ) . Max ( ) ;
303312
0 commit comments