LegendBox Customization

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Arction_LasseP

User avatar
blakeadkins
Posts: 44
Joined: Tue Feb 25, 2014 7:49 pm

LegendBox Customization

Post by blakeadkins » Wed Jan 14, 2015 9:25 pm

I'm showing a lot of channels (128) on 1 chart and the Legend Box covers a big portion of the chart. I'd like the legend to be accessible quickly if I need it. Is there a way to pin it or something like that and show when I hover over that? If not can this be added as a feature request?
chart.png
chart.png (82.38 KiB) Viewed 5809 times

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

Re: LegendBox Customization

Post by ArctionPasi » Wed Jan 14, 2015 10:55 pm

There's currently no built-in feature for collapsing the legendbox, but here's the code to achieve this functionality:

Code: Select all


m_chart.ViewXY.LegendBox.MouseOverOn += new MouseEventHandler(LegendBox_MouseOverOn);
            m_chart.ViewXY.LegendBox.MouseOverOff += new MouseEventHandler(LegendBox_MouseOverOff);

void LegendBox_MouseOverOff(object sender, MouseEventArgs e)
        {
            m_chart.BeginUpdate();

            foreach (SeriesBaseXY series in m_chart.ViewXY.GetAll2DSeries())
                series.ShowInLegendBox = false;

            m_chart.EndUpdate(); 
        }

        void LegendBox_MouseOverOn(object sender, MouseEventArgs e)
        {
            m_chart.BeginUpdate(); 

            foreach(SeriesBaseXY series in m_chart.ViewXY.GetAll2DSeries())
                series.ShowInLegendBox = true;

            m_chart.EndUpdate(); 
        }
:geek:
LightningChart Support Team, PT

User avatar
blakeadkins
Posts: 44
Joined: Tue Feb 25, 2014 7:49 pm

Re: LegendBox Customization

Post by blakeadkins » Thu Jan 15, 2015 9:46 pm

Is it possible that the LegendBox will eventually be made into a FrameworkElement so that i can be more easily manipulated and customized?

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

Re: LegendBox Customization

Post by ArctionPasi » Fri Jan 16, 2015 12:08 pm

FrameworkElement is not unfortunately a suitable approach, LightningChart uses low-level DirectX rendering. Mouse events and appearance settings are different from what FrameworkElement provides.

If LC's legend box doesn't provide suitable functionality for your application, you can of course create a custom UserControl, populating it from series titles, and placing it over the chart.
LightningChart Support Team, PT