Background LegendBoxes

A forum dedicated to WPF version of LightningChart Ultimate.

Background LegendBoxes

Postby denkhe » Wed Jul 31, 2019 8:18 am

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
BlackLegendBox.jpg
ViewXY with 1 LegendBox
BlackLegendBox.jpg (52.21 KiB) Viewed 79 times
denkhe
 
Posts: 4
Joined: Tue Jul 30, 2019 7:03 am

Re: Background LegendBoxes

Postby Arction_LasseP » Wed Jul 31, 2019 9:55 am

Hello,

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


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.

Code: Select all
_chart.ViewXY.LegendBoxes[0].SeriesTitleColor = Colors.Black;
_chart.ViewXY.LegendBoxes[0].CheckBoxColor = Colors.Black;
_chart.ViewXY.LegendBoxes[0].CheckMarkColor = Colors.Blue;


Hope this helps.
Lasse
Arction_LasseP
 
Posts: 39
Joined: Wed Mar 27, 2019 1:05 pm

Re: Background LegendBoxes

Postby denkhe » Wed Jul 31, 2019 11:59 am

Thanks a lot! I am almost there :D

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
LegendBox.jpg
Screenshot
LegendBox.jpg (64.67 KiB) Viewed 72 times
denkhe
 
Posts: 4
Joined: Tue Jul 30, 2019 7:03 am

Re: Background LegendBoxes

Postby Arction_LasseP » Wed Jul 31, 2019 1:00 pm

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:

Code: Select all
_chart.ViewXY.XAxes[0].Title.Shadow.Style = TextShadowStyle.Off;


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:

Code: Select all
_chart.ViewXY.LegendBoxes[0].ShowIcons = false;


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
Arction_LasseP
 
Posts: 39
Joined: Wed Mar 27, 2019 1:05 pm

Re: Background LegendBoxes

Postby denkhe » Wed Jul 31, 2019 2:27 pm

Works for me :D
Thank you!
denkhe
 
Posts: 4
Joined: Tue Jul 30, 2019 7:03 am


Return to LightningChart Ultimate WPF

Who is online

Users browsing this forum: No registered users and 9 guests

cron