Profile Picture

Custom axes in 3D chart

Posted By Manal Goyal 6 Years Ago
Author
Message
Manal Goyal
Question Posted 6 Years Ago
View Quick Profile
Forum Member

Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)

Group: Forum Members
Last Active: 5 Years Ago
Posts: 29, Visits: 405
Hi Team,

I have a 3D chart where on the x axis I have the range from -15 to 15. Now what I want is to have  different ranges on the axis, the half of my axis is to have a range from 15 to 10(left to right) and then again the later half of my axis should have a range of 10 to 15(from left to right).

How can I achieve this using nevron. Hope its not confusing. Please let me know if more clarification is needed on this.


Nevron Support
Posted 6 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)

Group: Forum Members
Last Active: Last Year
Posts: 3,039, Visits: 3,746
Hi Manal,

You can achieve this using a scale break - check out the following example - All Examples \ Axes \ Scale Breaks \ Custom Scale Break - it shows how you can insert a custom scale break. That way you can split the axis at specified position and range.


Best Regards,
Nevron Support Team



Manal Goyal
Posted 6 Years Ago
View Quick Profile
Forum Member

Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)

Group: Forum Members
Last Active: 5 Years Ago
Posts: 29, Visits: 405
Hi,

I believe my requirement is little bit different, I am not looking to put a break in the scale but rather having 2 different scales on a axis.
For half of the axis it should show the range from a to b and for the other half from b to a, so the over all axis range should be a,b,a.

Thank you


Nevron Support
Posted 6 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)

Group: Forum Members
Last Active: Last Year
Posts: 3,039, Visits: 3,746
Hi Manal,
Ok - in this case you need to take a look at the Axes \ General \ Ruler Size example - it shows how to have axes that share the same plot side. Also take a look at the following topic:
http://helpdotnetvision.nevron.com/#UsersGuide_Axes_Cartesian_Axis_Anchors.html
Hope this helps - let us know if you have any questions.

Best Regards,
Nevron Support Team



Manal Goyal
Posted 6 Years Ago
View Quick Profile
Forum Member

Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)

Group: Forum Members
Last Active: 5 Years Ago
Posts: 29, Visits: 405
Hi,
Just for further clarification, the example shows how to create multiple axes on the same zone, I was looking to have 2 scales on the same axis. or lets say just one scale is also enough for me but the range of scale should be like a-b-a, is that a possibility or I have to achieve it using 2 different axes.

Thank you.


Nevron Support
Posted 6 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)

Group: Forum Members
Last Active: Last Year
Posts: 3,039, Visits: 3,746
Hi Manal,
Yes you need to use different axes - the control does not support irregular scales.

Best Regards,
Nevron Support Team



Manal Goyal
Posted 6 Years Ago
View Quick Profile
Forum Member

Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)

Group: Forum Members
Last Active: 5 Years Ago
Posts: 29, Visits: 405
Hi,

I created the axis like this:
var axis = ((NCartesianAxisCollection)cartesianChart.Axes).AddCustomAxis(AxisOrientation.Horizontal,
      AxisDockZone.FrontTop);

But the axis is at the fixed position while I want the axis to stay on the chart wall as I rotate my 3D chart and wall changes its position to have the best visibility. how do i achieve that



Manal Goyal
Posted 6 Years Ago
View Quick Profile
Forum Member

Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)

Group: Forum Members
Last Active: 5 Years Ago
Posts: 29, Visits: 405
Hi,
This is the code that I used to produce the axes for this scenario:


And this is the code that I used:
private List<NAxis> ConfigureXaxis(string title)
   {
    NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator();
    scaleX.RoundToTickMax = false;
    scaleX.RoundToTickMin = false;
    scaleX.Title.Text = title;
    scaleX.Title.TextStyle.TextFormat = TextFormat.XML;
    scaleX.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Back };
    scaleX.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;
    _cartesianChart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX;
    _cartesianChart.Axis(StandardAxis.PrimaryX).Anchor = new NAutoSideAxisAnchor(AxisOrientation.Horizontal);
    _cartesianChart.Axis(StandardAxis.PrimaryX).View =
      new NRangeAxisView(new NRange1DD(-_xAxisRange / 2, _xAxisRange / 2), true, true);

    var axes = new List<NAxis>();
    axes.Add(AddScale(_cartesianChart,0,45));
    axes.Add(AddScale(_cartesianChart,55,100));
    return axes;
   }

   private NAxis AddScale(NCartesianChart cartesianChart, double begin, double end)
   {
    NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator();
    scaleX.RoundToTickMax = false;
    scaleX.RoundToTickMin = false;
    scaleX.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Back };
    scaleX.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;
    var axis = ((NCartesianAxisCollection)cartesianChart.Axes).AddCustomAxis(AxisOrientation.Horizontal,
      AxisDockZone.FrontBottom);
    axis.Visible = true;
    axis.Anchor = new NBestVisibilityAxisAnchor(AxisOrientation.Horizontal);
    axis.Anchor.BeginPercent = (float)begin;
    axis.Anchor.EndPercent = (float)end;
    axis.ScaleConfigurator = scaleX;

    return axis;
   }


Now I want to make the axis from -10 to 10 disappear and merge the other to axis n the same line and keep the "X-axis Title" as it is.
Can you help me in this.
Regards
Manal.


Nevron Support
This post has been flagged as an answer
Posted 6 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)

Group: Forum Members
Last Active: Last Year
Posts: 3,039, Visits: 3,746
Hi Manal,
In short you need to have the two axes share the same axis zone level which is achieved by setting the CreateNewZoneLevel property of the Anchor to false, then you need to have another axis that shows the title at the center - for example:
   NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];

    NBarSeries bar1 = new NBarSeries();
    bar1.Values.Add(10);
    bar1.Values.Add(20);
    bar1.Values.Add(30);
    bar1.Values.Add(40);
    chart.Series.Add(bar1);

    NBarSeries bar2 = new NBarSeries();
    bar2.Values.Add(10);
    bar2.Values.Add(20);
    bar2.Values.Add(30);
    bar2.Values.Add(40);
    chart.Series.Add(bar2);

    NBarSeries invisibleBars = new NBarSeries();
    invisibleBars.Values.Add(0);
    invisibleBars.FillStyle = new NColorFillStyle(Color.Transparent);
    invisibleBars.BorderStyle.Width = new NLength(0);
    chart.Series.Add(invisibleBars);

    chart.Axis(StandardAxis.PrimaryX).Visible = false;

    NAxis xAxis1 = ((NCartesianAxisCollection)chart.Axes).AddCustomAxis(AxisOrientation.Horizontal, AxisDockZone.FrontBottom);
    NDockAxisAnchor dockAnchor1 = new NDockAxisAnchor(AxisDockZone.FrontBottom, false);
    dockAnchor1.BeginPercent = 0;
    dockAnchor1.EndPercent = 50;
    dockAnchor1.CreateNewZoneLevel = false;
    xAxis1.Anchor = dockAnchor1;

    bar1.DisplayOnAxis(StandardAxis.PrimaryX, false);
    bar1.DisplayOnAxis(xAxis1.AxisId, true);

    NAxis xAxis2 = ((NCartesianAxisCollection)chart.Axes).AddCustomAxis(AxisOrientation.Horizontal, AxisDockZone.FrontBottom);
    NDockAxisAnchor dockAnchor2 = new NDockAxisAnchor(AxisDockZone.FrontBottom, false);
    dockAnchor2.BeginPercent = 50;
    dockAnchor2.EndPercent = 100;
    dockAnchor2.CreateNewZoneLevel = false;
    xAxis2.Anchor = dockAnchor2;

    bar2.DisplayOnAxis(StandardAxis.PrimaryX, false);
    bar2.DisplayOnAxis(xAxis2.AxisId, true);

    NAxis xAxis3 = ((NCartesianAxisCollection)chart.Axes).AddCustomAxis(AxisOrientation.Horizontal, AxisDockZone.FrontBottom);
    xAxis3.Visible = true;
    xAxis3.ScaleConfigurator.Title.Text = "Some Text";
    invisibleBars.DisplayOnAxis(StandardAxis.PrimaryX, false);
    invisibleBars.DisplayOnAxis(xAxis3.AxisId, true);


Best Regards,
Nevron Support Team



Manal Goyal
Posted 6 Years Ago
View Quick Profile
Forum Member

Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)

Group: Forum Members
Last Active: 5 Years Ago
Posts: 29, Visits: 405
Hi Team,

Nice fix, Just one hiccup, If if try to fix the range of the xAxis1 in this code in decreasing order from 3 to 0 like this:

    xAxis1.View = new NRangeAxisView(new NRange1DD(3, 0), true, true);
Then there is no series displayed on this axis. Anyway to get it working?

Thank you




Similar Topics


Reading This Topic