Profile Picture

Pie Chart - Label Mode

Posted By Jerry Jacob 9 Years Ago
Author
Message
Nevron Support
Posted 9 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: Yesterday @ 1:54 AM
Posts: 3,054, Visits: 4,009
Hi Jerry,

Unfortunately currently there is no way to force the control to achieve this - unless there is an option like rim no overlap where the labels don't push the pie chart inside. We'll consider adding such an option in the control, but this can take a while...

Best Regards,
Nevron Support Team



Jerry Jacob
Posted 9 Years Ago
View Quick Profile
Forum Newbie

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
Last Active: 9 Years Ago
Posts: 15, Visits: 78
The problem comes when the pie looks like this.

https://www.nevron.com/forum/uploads/images/003a2542-c2fb-41ae-92a0-0fef.jpg

Where 2 exactly same sized charts show up differently because the labeling.  Ideally we would want both of these pies that are placed as subreports in another report to show up identically sized. where as right now in one the label dominates more space and shrinks the pie chart.  Any suggestions would be greatly appreciated.  Thanks!

Jerry Jacob
Posted 9 Years Ago
View Quick Profile
Forum Newbie

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
Last Active: 9 Years Ago
Posts: 15, Visits: 78
I understand that, I was wondering if there was a suggested alternative.  Something that lets me adjust the length of the arrows while maintaining spiderNoOverlap.  Something to the degree of not forcing all the labels to align on the right or left side.

Using spiderNoOverlap, even when hiding a most of the labels and using the anchor to put them inside the pie chart, what ends up happening is the arrows extend to the point as if those "hidden" labels are still there so as to align with them.  https://www.nevron.com/forum/uploads/images/7190ab2c-2086-4d99-851d-85a6.jpg

https://www.nevron.com/forum/uploads/images/e472b984-2c16-4b56-9192-bd35.jpg

You can see the size difference, and it isn't so much the size difference as the wasted space that the line is taking up unnecessarily in the SpiderNoOverlap.  I believe its because it is trying to align the labels that are hidden also as seen below.

https://www.nevron.com/forum/uploads/images/fd5f9da1-9b01-419a-b770-7c06.jpg

Is there any suggestions to help shrink those lines while preserving no Overlap?

Nevron Support
Posted 9 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: Yesterday @ 1:54 AM
Posts: 3,054, Visits: 4,009
Hi Jerry,

Unfortunately the control currently does not support non overlapping labels resolve when in Rim mode.


Best Regards,
Nevron Support Team



Jerry Jacob
Posted 9 Years Ago
View Quick Profile
Forum Newbie

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
Last Active: 9 Years Ago
Posts: 15, Visits: 78
I tried that but when it is in SpiderNoOverlap it doesn't seem to use that property at all.  It just auto places the labels shrinking the chart. Whether i set it to 0 or 50 it doesn't affect it.  If I change to Rim those properties seem to get used, but when I tried it under certain conditions the text overlaps.  The Ideal situation is something that would be like Rim No Overlap.


Nevron Support
Posted 9 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: Yesterday @ 1:54 AM
Posts: 3,054, Visits: 4,009
Hi Jerry,

You can try to diminish the LeadOffArrowLength and ConnectorLength properties - for example:
pieSeries.LeadOffArrowLength = new NLength(0);
pieSeries.ConnectorLength = new NLength(0);


Best Regards,
Nevron Support Team



Jerry Jacob
Posted 9 Years Ago
View Quick Profile
Forum Newbie

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
Last Active: 9 Years Ago
Posts: 15, Visits: 78
That was a big help.  Sorry for posting this in the wrong sub-forum.  

There is one last piece that I am trying to work through.  The LabelMode - If I use rim or Spider there are times when text overlaps, but when I use SpiderNoOverlap the arrows are so long that it shrinks the entire chart.  Is there a way so that the labels don't overlap but use the minimum space necessary with the arrow?

Nevron Support
Posted 9 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: Yesterday @ 1:54 AM
Posts: 3,054, Visits: 4,009
Hi Jerrry,

This obviously relates to SSRS - in this case you simply need to use the context.Document, instead of nChartControl and you'll be OK - for example:

context.document.RootPanel.ChildPanels.Clear();

However in your case we think that you should not clear the panels collection - the pie chart is already created and configured - you just need to alter some label settings so the code should simply omit the Clear line of code:

NChart1.Panels.Clear();

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


Best Regards,
Nevron Support Team



Jerry Jacob
Posted 9 Years Ago
View Quick Profile
Forum Newbie

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
Last Active: 9 Years Ago
Posts: 15, Visits: 78
Where would I find the name though?  Under properties I see NChart1, but when I try using it I get an error

Compiling...
(25,13) : error CS0103: The name 'NChart1' does not exist in the current context
Compiled with 1 error(s).

Not sure if its because of how I have the code set up referencing context in the RSMain, but not sure how to adjust it to do what we are trying.

I pasted the code below in case it will help in solving this.  I really appreciate your efforts on this.

Thanks,

using System;
using System.Drawing;
using Nevron.GraphicsCore;
using Nevron.Chart;
using Nevron.ReportingServices;
using System.Text.RegularExpressions;

namespace MyNamespace
{
  public class MyClass
  {
    public static void RSMain(NRSChartCodeContext context)
    {
    
      if (context.document.Charts.Count == 0)
        return;
        
     NChart1.Panels.Clear();
      NPieChart pieChart = context.document.Charts[0] as NPieChart;
      
      if (pieChart == null)
        return;
        
      NPieSeries pieSeries = pieChart.Series[0] as NPieSeries;
    
      int dpCount = pieSeries.Values.Count / 2;
      int backColorOffset = dpCount;

      for (int i = 0; i < dpCount; i++)
      {
      string strColors = (string)pieSeries.Labels[backColorOffset+i];
      if (strColors == "") {
      strColors = "0,0,0";
      }
      char[] delimiterChars = {','};
      string[] intColors = strColors.Split(delimiterChars);
      int[] convertedItems = Array.ConvertAll<string, int>(intColors, int.Parse);
      
       Color pieColor = Color.FromArgb(convertedItems[0],convertedItems[1],convertedItems[2]);
       Color pieColor_White = Color.FromArgb(255,255,255);
      
       pieSeries.FillStyles[i] = new NColorFillStyle(pieColor);
       pieSeries.BorderStyles[i] = new NStrokeStyle(.1f, pieColor_White);
       pieSeries.DataLabelStyle.ArrowStrokeStyle = new NStrokeStyle(pieColor);
     
      }
      
      // clean up the chart
      for (int i = pieSeries.Values.Count - 1; i >= dpCount; i--)
      {
        pieSeries.RemoveDataPointAt(i);
      }
    }
  }
}




Nevron Support
Posted 9 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: Yesterday @ 1:54 AM
Posts: 3,054, Visits: 4,009
Hi Jerry,

The NChartControl instance (nChartControl) is automatically created by the designer when you drop the control on the form. Your control can have a different name of course... Let us know if you meet any problems.


Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic