Customisation of Legend

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
hallo888
Posts: 43
Joined: Wed Mar 26, 2014 10:56 am

Customisation of Legend

Post by hallo888 » Fri Sep 05, 2014 8:33 am

Hi,

I have a multiple TimeLineCollection in a ViewXY chart. Each timeline collection contains multiple segment lines. These segment lines can either be represented by blue or red colour. May i know is there a way to customize the legend to display what does red represent and what does blue represent? Currently, the default legend is displaying 1 item for each segment line.

Can that be done in .xaml file?

Please advise.

Thank You.

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: Customisation of Legend

Post by ArctionPasi » Tue Sep 09, 2014 3:44 pm

Hi,

Yes that can be done.

Set one LineCollection which doesn't have any actual data. One for blue lines, one for red lines. Their Title.ShowInLegendBox can be set to their default value, True.

Then, create several LineCollections, some blue, some red. Set their Title.ShowInLegendBox = false.

Then you'll have only two items in the legend box, one red, and one blue.

Code: Select all

        <lcu:LightningChartUltimate Content="LightningChartUltimate">
            <lcu:LightningChartUltimate.ViewXY>
                <lcu:ViewXY>
                    <lcu:ViewXY.LineCollections>
                        <lcu:LineCollection>
                            <lcu:LineCollection.Title>
                                <lcu:SeriesTitle Text="Red lines"/>
                            </lcu:LineCollection.Title>
                            <lcu:LineCollection.LineStyle>
                                <lcu:LineStyle Color="Red"/>
                            </lcu:LineCollection.LineStyle>
                        </lcu:LineCollection>
                        <lcu:LineCollection>
                            <lcu:LineCollection.Title>
                                <lcu:SeriesTitle Text="Blue lines"/>
                            </lcu:LineCollection.Title>
                            <lcu:LineCollection.LineStyle>
                                <lcu:LineStyle Color="Blue"/>
                            </lcu:LineCollection.LineStyle>
                        </lcu:LineCollection>
                        <lcu:LineCollection>
                            <lcu:LineCollection.Title>
                                <lcu:SeriesTitle ShowInLegendBox="False"/>
                            </lcu:LineCollection.Title>
                            <lcu:LineCollection.LineStyle>
                                <lcu:LineStyle Color="Red"/>
                            </lcu:LineCollection.LineStyle>
                        </lcu:LineCollection>
                        <lcu:LineCollection>
                            <lcu:LineCollection.Title>
                                <lcu:SeriesTitle ShowInLegendBox="False"/>
                            </lcu:LineCollection.Title>
                            <lcu:LineCollection.LineStyle>
                                <lcu:LineStyle Color="Red"/>
                            </lcu:LineCollection.LineStyle>
                        </lcu:LineCollection>
                        <lcu:LineCollection>
                            <lcu:LineCollection.LineStyle>
                                <lcu:LineStyle Color="Blue"/>
                            </lcu:LineCollection.LineStyle>
                            <lcu:LineCollection.Title>
                                <lcu:SeriesTitle ShowInLegendBox="False"/>
                            </lcu:LineCollection.Title>
                        </lcu:LineCollection>
                    </lcu:ViewXY.LineCollections>
                </lcu:ViewXY>
            </lcu:LightningChartUltimate.ViewXY>
        </lcu:LightningChartUltimate>

LightningChart Support Team, PT

Post Reply