How to make the legend panel scrollable


Author
Message
Xiaolong Zhu
Xiaolong Zhu
Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)
Group: Forum Members
Posts: 18, Visits: 1

Hi

I have a chart displays lots of different series. At before i added the legend pane to the same nevron chart control as the chart was added to, but i found the chart control seemed very crowded since too many legend items listed in the legen pane, and even worse, some of the legend items have too long text. So i decided to build a additional floatable winform user control to host a nchartcontrol only for legend panel. i just wonder is there any way to make the legend pane scrollable like the attached pic? thanks.

Regards,

xl


Attachments
legend.jpg (114 views, 21.00 KB)
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hi Xialong,

You can place the chart inside a scrollable panel and resize the chart inside using the following code:

         nChartControl1.Panels.Clear();
         nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

         NLegend legend = new NLegend();
         legend.UseAutomaticSize = true;
         nChartControl1.Panels.Add(legend);
         legend.Mode = LegendMode.Manual;
         legend.Location = new Nevron.GraphicsCore.NPointL(0, 0);

         for (int i = 0; i < 10; i++)
         {
            NLegendItemCellData licd = new NLegendItemCellData();
            licd.Text = "Legend Item " + i.ToString();

            legend.Data.Items.Add(licd);
         }


         nChartControl1.Document.Calculate();
         nChartControl1.Document.RecalcLayout(nChartControl1.View.Context);

         nChartControl1.Width = (int)legend.ContentArea.Width;
         nChartControl1.Height = (int)legend.ContentArea.Height;

Hope this helps - let us know if you meet any problems.

Best Regards,
Nevron Support Team


Xiaolong Zhu
Xiaolong Zhu
Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)
Group: Forum Members
Posts: 18, Visits: 1

HI

Thanks for your reply. i tried using  the attached code based on your provide to achieve that but it still didn't show the srcoll bar, could you take a look? Thanks.

 

xiaolong


Attachments
ScrollableLegend.zipx (96 views, 13.00 KB)
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search