Page 1 of 1

Customisation of Legend

Posted: Fri Sep 05, 2014 8:33 am
by hallo888
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.

Re: Customisation of Legend

Posted: Tue Sep 09, 2014 3:44 pm
by ArctionPasi
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>