Background LegendBoxes
Moderator: Queue Moderators
Background LegendBoxes
I would like to change the background- color of a LegendBox from black to white (see attachment) but could not find a way to do this. Dos anybody know how this is done?
- Attachments
-
- ViewXY with 1 LegendBox
- BlackLegendBox.jpg (52.21 KiB) Viewed 6515 times
-
- Posts: 141
- Joined: Wed Mar 27, 2019 1:05 pm
Re: Background LegendBoxes
Hello,
The background color and style of a LegendBox can be customized as follows:
If the background should be white, it might be necessary to change at least the font color of the series titles as well as checkbox colors if you are using them.
Hope this helps.
Lasse
The background color and style of a LegendBox can be customized as follows:
Code: Select all
_chart.ViewXY.LegendBoxes[0].Fill.Style = RectFillStyle.ColorOnly; // LegendBox filled with color. A bitmap or transparent background can be set also
_chart.ViewXY.LegendBoxes[0].Fill.GradientFill = GradientFill.Solid; // Use gradient or solid color
_chart.ViewXY.LegendBoxes[0].Fill.Color = Colors.White; // Setting the actual background color
_chart.ViewXY.LegendBoxes[0].BorderColor = Colors.Gray; // The color of the LegendBox border
Code: Select all
_chart.ViewXY.LegendBoxes[0].SeriesTitleColor = Colors.Black;
_chart.ViewXY.LegendBoxes[0].CheckBoxColor = Colors.Black;
_chart.ViewXY.LegendBoxes[0].CheckMarkColor = Colors.Blue;
Lasse
Re: Background LegendBoxes
Thanks a lot! I am almost there
Two issues remain:
Two issues remain:
- 1. Is there a way to get rid of the small black line under the squares?
2. The text "Meistereien" seems to have a shadow and does not look sharp. Is there a way to change this?
- Attachments
-
- Screenshot
- LegendBox.jpg (64.67 KiB) Viewed 6508 times
-
- Posts: 141
- Joined: Wed Mar 27, 2019 1:05 pm
Re: Background LegendBoxes
Hi,
About the remaining issues, the second one should be easy to solve, assuming that the "Meistereien" -text is the title of the X-axis. The following will disable the shadow:
Title.Shadow.Style = TextShadowStyle.Off can also be use with several other texts such as series titles.
The first issue is another story. The squares with the lines are series icons indicating the series type (BarSeries, PointLineSeries etc.). As the small black line belongs to the BarSeries icon, it cannot be removed. The icons themselves can be disabled via:
The only workaround for this is to set ShowInLegendBox = false to the actual series shown in chart, and then create dummy series with different kind of icons, in this case Bands as their icon is just a square. Set them to use the same colors as the respective BarSeries but disable their visibility so that they are not shown in the chart but only in the LegendBox. However, this approach is rather complicated for a such a small issue. Whether it is worth it is of course entirely up to you.
Best regards,
Lasse
About the remaining issues, the second one should be easy to solve, assuming that the "Meistereien" -text is the title of the X-axis. The following will disable the shadow:
Code: Select all
_chart.ViewXY.XAxes[0].Title.Shadow.Style = TextShadowStyle.Off;
The first issue is another story. The squares with the lines are series icons indicating the series type (BarSeries, PointLineSeries etc.). As the small black line belongs to the BarSeries icon, it cannot be removed. The icons themselves can be disabled via:
Code: Select all
_chart.ViewXY.LegendBoxes[0].ShowIcons = false;
Best regards,
Lasse
Re: Background LegendBoxes
Works for me
Thank you!
Thank you!