@@ -457,7 +457,7 @@ private void RenderTitle(IRenderContext rc)
457457 /// <param name="rc">The rendering context.</param>
458458 private void UpdatePlotArea ( IRenderContext rc )
459459 {
460- var plotArea = new OxyRect (
460+ var plotAndAxisArea = new OxyRect (
461461 this . PlotBounds . Left + this . Padding . Left ,
462462 this . PlotBounds . Top + this . Padding . Top ,
463463 Math . Max ( 0 , this . Width - this . Padding . Left - this . Padding . Right ) ,
@@ -468,10 +468,10 @@ private void UpdatePlotArea(IRenderContext rc)
468468 if ( titleSize . Height > 0 )
469469 {
470470 var titleHeight = titleSize . Height + this . TitlePadding ;
471- plotArea = new OxyRect ( plotArea . Left , plotArea . Top + titleHeight , plotArea . Width , Math . Max ( 0 , plotArea . Height - titleHeight ) ) ;
471+ plotAndAxisArea = new OxyRect ( plotAndAxisArea . Left , plotAndAxisArea . Top + titleHeight , plotAndAxisArea . Width , Math . Max ( 0 , plotAndAxisArea . Height - titleHeight ) ) ;
472472 }
473473
474- plotArea = plotArea . Deflate ( this . ActualPlotMargins ) ;
474+ var plotArea = plotAndAxisArea . Deflate ( this . ActualPlotMargins ) ;
475475
476476 if ( this . IsLegendVisible )
477477 {
@@ -485,9 +485,14 @@ private void UpdatePlotArea(IRenderContext rc)
485485 ( l . LegendPosition == LegendPosition . LeftTop || l . LegendPosition == LegendPosition . LeftMiddle || l . LegendPosition == LegendPosition . LeftBottom ) ) ) )
486486 {
487487 // Find the available size for the legend box
488- var availableLegendWidth = plotArea . Width ;
489- var availableLegendHeight = double . IsNaN ( legend . LegendMaxHeight ) ?
490- plotArea . Height : Math . Min ( plotArea . Height , legend . LegendMaxHeight ) ;
488+ var availableLegendWidth = legend . AllowUseFullExtent
489+ ? plotAndAxisArea . Width
490+ : plotArea . Width ;
491+ var availableLegendHeight = legend . AllowUseFullExtent
492+ ? plotAndAxisArea . Height
493+ : plotArea . Height ;
494+ availableLegendHeight = double . IsNaN ( legend . LegendMaxHeight ) ?
495+ availableLegendHeight : Math . Min ( availableLegendHeight , legend . LegendMaxHeight ) ;
491496
492497 var lsiz = legend . GetLegendSize ( rc , new OxySize ( availableLegendWidth , availableLegendHeight ) ) ;
493498 legend . LegendSize = lsiz ;
@@ -511,9 +516,14 @@ private void UpdatePlotArea(IRenderContext rc)
511516 ( l . LegendPosition == LegendPosition . RightTop || l . LegendPosition == LegendPosition . RightMiddle || l . LegendPosition == LegendPosition . RightBottom ) ) ) )
512517 {
513518 // Find the available size for the legend box
514- var availableLegendWidth = plotArea . Width ;
515- var availableLegendHeight = double . IsNaN ( legend . LegendMaxHeight ) ?
516- plotArea . Height : Math . Min ( plotArea . Height , legend . LegendMaxHeight ) ;
519+ var availableLegendWidth = legend . AllowUseFullExtent
520+ ? plotAndAxisArea . Width
521+ : plotArea . Width ;
522+ var availableLegendHeight = legend . AllowUseFullExtent
523+ ? plotAndAxisArea . Height
524+ : plotArea . Height ;
525+ availableLegendHeight = double . IsNaN ( legend . LegendMaxHeight ) ?
526+ availableLegendHeight : Math . Min ( availableLegendHeight , legend . LegendMaxHeight ) ;
517527
518528 var lsiz = legend . GetLegendSize ( rc , new OxySize ( availableLegendWidth , availableLegendHeight ) ) ;
519529 legend . LegendSize = lsiz ;
@@ -537,9 +547,14 @@ private void UpdatePlotArea(IRenderContext rc)
537547 ( l . LegendPosition == LegendPosition . TopLeft || l . LegendPosition == LegendPosition . TopCenter || l . LegendPosition == LegendPosition . TopRight ) ) ) )
538548 {
539549 // Find the available size for the legend box
540- var availableLegendWidth = plotArea . Width ;
541- var availableLegendHeight = double . IsNaN ( legend . LegendMaxHeight ) ?
542- plotArea . Height : Math . Min ( plotArea . Height , legend . LegendMaxHeight ) ;
550+ var availableLegendWidth = legend . AllowUseFullExtent
551+ ? plotAndAxisArea . Width
552+ : plotArea . Width ;
553+ var availableLegendHeight = legend . AllowUseFullExtent
554+ ? plotAndAxisArea . Height
555+ : plotArea . Height ;
556+ availableLegendHeight = double . IsNaN ( legend . LegendMaxHeight ) ?
557+ availableLegendHeight : Math . Min ( availableLegendHeight , legend . LegendMaxHeight ) ;
543558
544559 var lsiz = legend . GetLegendSize ( rc , new OxySize ( availableLegendWidth , availableLegendHeight ) ) ;
545560 legend . LegendSize = lsiz ;
@@ -563,9 +578,14 @@ private void UpdatePlotArea(IRenderContext rc)
563578 ( l . LegendPosition == LegendPosition . BottomLeft || l . LegendPosition == LegendPosition . BottomCenter || l . LegendPosition == LegendPosition . BottomRight ) ) ) )
564579 {
565580 // Find the available size for the legend box
566- var availableLegendWidth = plotArea . Width ;
567- var availableLegendHeight = double . IsNaN ( legend . LegendMaxHeight ) ?
568- plotArea . Height : Math . Min ( plotArea . Height , legend . LegendMaxHeight ) ;
581+ var availableLegendWidth = legend . AllowUseFullExtent
582+ ? plotAndAxisArea . Width
583+ : plotArea . Width ;
584+ var availableLegendHeight = legend . AllowUseFullExtent
585+ ? plotAndAxisArea . Height
586+ : plotArea . Height ;
587+ availableLegendHeight = double . IsNaN ( legend . LegendMaxHeight ) ?
588+ availableLegendHeight : Math . Min ( availableLegendHeight , legend . LegendMaxHeight ) ;
569589
570590 var lsiz = legend . GetLegendSize ( rc , new OxySize ( availableLegendWidth , availableLegendHeight ) ) ;
571591 legend . LegendSize = lsiz ;
0 commit comments