Profile Picture

How to make the legend panel scrollable

Posted By Xiaolong Zhu 11 Years Ago
Author
Message
Xiaolong Zhu
Posted 11 Years Ago
View Quick Profile
Junior Member

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
Last Active: 11 Years Ago
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 (79 views, 13.00 KB)
Nevron Support
Posted 11 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009
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
Posted 11 Years Ago
View Quick Profile
Junior Member

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
Last Active: 11 Years Ago
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 (94 views, 21.00 KB)


Similar Topics


Reading This Topic