Page 1 of 1

LegendBox Customization

Posted: Wed Jan 14, 2015 9:25 pm
by blakeadkins
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 6913 times

Re: LegendBox Customization

Posted: Wed Jan 14, 2015 10:55 pm
by ArctionPasi
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:

Re: LegendBox Customization

Posted: Thu Jan 15, 2015 9:46 pm
by blakeadkins
Is it possible that the LegendBox will eventually be made into a FrameworkElement so that i can be more easily manipulated and customized?

Re: LegendBox Customization

Posted: Fri Jan 16, 2015 12:08 pm
by ArctionPasi
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.