Pie Chart - Label Mode


Author
Message
Jerry Jacob
Jerry Jacob
Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)
Group: Forum Members
Posts: 15, Visits: 78
Is there a way to change the labelmode based on the data?

Something along the lines of

     
if (pieSeries.Values[i] > .1){
        //I want to change the labelMode of this value to Center on the pie chart
        pieSeries.LabelMode = PieLabelMode.Center;
       }else {
        //I want to change the labelMode of this value to SpiderNoOverlap on the pie chart
        pieSeries.LabelMode = PieLabelMode.SpiderNoOverlap;
       }


Also how can I adjust the lengths of the lines for SpiderNoOverlap.  I tried the following without success.

      pieSeries.DataLabelStyle.ArrowLength = new NLength(1.0f,NRelativeUnit.ParentPercentage);
      pieSeries.DataLabelStyle.ArrowPointerLength = new NLength(1.0f,NRelativeUnit.ParentPercentage);




Reply
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 Jerry,
One solution would be to use anchor panels for the labels that you wish to exclude from automatic layout. The following code snippet shows how to achieve this:

   nChartControl1.Panels.Clear();

   NPieChart pieChart = new NPieChart();

   nChartControl1.Panels.Add(pieChart);

   NPieSeries pieSeries = new NPieSeries();
   pieChart.Series.Add(pieSeries);

   pieSeries.Values.Add(10);
   pieSeries.Values.Add(10);
   pieSeries.Values.Add(10);
   pieSeries.LabelMode = PieLabelMode.SpiderNoOverlap;

   pieSeries.Labels.Add("One");
   pieSeries.Labels.Add("");
   NDataLabelStyle dls = new NDataLabelStyle();
   dls.Visible = false;
   pieSeries.DataLabelStyles[1] = dls;
   pieSeries.Labels.Add("Three");

   NLabel label = new NLabel("Two");
   label.ContentAlignment = ContentAlignment.MiddleCenter;
   label.TextStyle = (NTextStyle)dls.TextStyle.Clone();
   NAnchorPanel anchorPanel = new NAnchorPanel();
   anchorPanel.ChildPanels.Add(label);
   anchorPanel.Anchor = new NPieDataPointAnchor(pieSeries, 1, 1, StringAlignment.Center);

   nChartControl1.Panels.Add(anchorPanel);

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


Best Regards,
Nevron Support Team


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Jerry Jacob - 10 Years Ago
Nevron Support - 10 Years Ago
Jerry Jacob - 10 Years Ago
Nevron Support - 10 Years Ago
Jerry Jacob - 10 Years Ago
Nevron Support - 10 Years Ago
Jerry Jacob - 10 Years Ago
Nevron Support - 10 Years Ago
Jerry Jacob - 10 Years Ago
Nevron Support - 10 Years Ago
Jerry Jacob - 10 Years Ago
Nevron Support - 10 Years Ago
Jerry Jacob - 10 Years Ago
Nevron Support - 10 Years Ago
                         I understand that, I was wondering if there was a suggested...
Jerry Jacob - 10 Years Ago
Jerry Jacob - 10 Years Ago
Nevron Support - 10 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search