Profile Picture

NOffsetTool - wrong offset

Posted By Viktor 13 Years Ago
Author
Message
Viktor
Posted 13 Years Ago
View Quick Profile
Junior Member

Junior Member (11 reputation)Junior Member (11 reputation)Junior Member (11 reputation)Junior Member (11 reputation)Junior Member (11 reputation)Junior Member (11 reputation)Junior Member (11 reputation)Junior Member (11 reputation)Junior Member (11 reputation)

Group: Forum Members
Last Active: 9 Years Ago
Posts: 11, Visits: 10
Hi!

The version of Nevron components is "Nevron .NET Vision 2011.1 for VS2010".

There are several NDockPanels within the root panel of NChartControl, all docked to the Top and of equal height. Each of them contains NLabel (Dock = Top), NLegend (Dock = None) and NCartesianChart (Dock = Fill).

NOffsetTool is added to NChartControl.Controller.Tools.

When one of the legends is being dragged with the mouse cursor, the actual vertical distance in pixels it passes is (vertical_distance_passed_by_mouse_cursor / number_of_dock_panels_within_the_root_panel), i.e. when there are 4 dock panels, and the vertical distance passed by the mouse cursor since BeginDrag event is 40 px, the actual vertical distance passed by the legend will be 10 px.

The horizontal offset is correct, though it probably wouldn't be in a case of several panels docked horizontally.

In a case of a single dock panel the vertical offset is correct.

Is there a workaround or fix for this issue?

Nevron Support
Posted 13 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 Victor,

In general the offset tool cannot operate on docked panels - only floating ones. Can you elaborate why you need this functionality?



Best Regards,
Nevron Support Team



Viktor
Posted 13 Years Ago
View Quick Profile
Junior Member

Junior Member (11 reputation)Junior Member (11 reputation)Junior Member (11 reputation)Junior Member (11 reputation)Junior Member (11 reputation)Junior Member (11 reputation)Junior Member (11 reputation)Junior Member (11 reputation)Junior Member (11 reputation)

Group: Forum Members
Last Active: 9 Years Ago
Posts: 11, Visits: 10
The offset tool is used to enable the user to drag the legend with mouse. As I mentioned, the legend is not docked.
The described configuration allows us to have multiple charts, each having its own legend and title label, within one chart control. Quite the same configuration (even more complicated one) is being used in one of the Nevron's demos.

Nevron Support
Posted 13 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 Victor,

We could not replicate the problem - the code we tested with was:

  private void Form1_Load(object sender, EventArgs e)
  {
   nChartControl1.Panels.Clear();

   for (int i = 0; i < 3; i++)
   {
    NDockPanel dockPanel1 = new NDockPanel();
    dockPanel1.Margins = new NMarginsL(10, 10, 10, 10);
    dockPanel1.PositionChildPanelsInContentBounds = true;
    dockPanel1.Size = new NSizeL(new NLength(30, NRelativeUnit.ParentPercentage), new NLength(30, NRelativeUnit.ParentPercentage));
    dockPanel1.Dock = DockStyle.Top;
    
    NDockPanel dockPanel2 = new NDockPanel();
    dockPanel2.Dock = DockStyle.Fill;

    NLabel label = new NLabel();
    label.Text = "this is my label";
    label.Dock = DockStyle.Top;
    dockPanel2.ChildPanels.Add(label);

    NCartesianChart chart = new NCartesianChart();
    chart.Dock = DockStyle.Fill;
    NBarSeries bar = new NBarSeries();
    bar.Values.Add(10);
    bar.Values.Add(20);
    bar.Values.Add(30);
    chart.Series.Add(bar);
    dockPanel2.ChildPanels.Add(chart);

    NLegend legend = new NLegend();
    dockPanel2.ChildPanels.Add(legend);

    dockPanel1.ChildPanels.Add(dockPanel2);

    nChartControl1.Panels.Add(dockPanel1);
    chart.DisplayOnLegend = legend;
   }

   nChartControl1.Controller.Tools.Add(new NSelectorTool());
   nChartControl1.Controller.Tools.Add(new NOffsetTool());
  }

A few questions:

1. Is this layout similar / identical to the one you use
2. What is the version of the control you're currently using?



Best Regards,
Nevron Support Team



Viktor
Posted 13 Years Ago
View Quick Profile
Junior Member

Junior Member (11 reputation)Junior Member (11 reputation)Junior Member (11 reputation)Junior Member (11 reputation)Junior Member (11 reputation)Junior Member (11 reputation)Junior Member (11 reputation)Junior Member (11 reputation)Junior Member (11 reputation)

Group: Forum Members
Last Active: 9 Years Ago
Posts: 11, Visits: 10
Thank you for the code sample.

1. The layout is almost the same, except we don't have the dockPanel2 - we would add all child elements directly to the dockPanel1.

2. The version of control is "Nevron .NET Vision 2011.1 for VS2010". The version of assemblies is "11.6.15.12".

I was able to reproduce the issue by adding any of the following lines of code:

// Particular PredefinedLegendStyle doesn't matter
legend.SetPredefinedLegendStyle(PredefinedLegendStyle.Left);

// Here, all NGraphicsUnits work fine, and so does the NRelativeUnit.RootPercentage
legend.Location = new NPointL(new NLength(0), new NLength(50, NRelativeUnit.ParentPercentage));

So, the issue can be reproduced by either setting the Predefined Style for the legend, or by defining the legend's location using NRelativeUnit.ParentPercentage. This doesn't depend on whether we use dockPanel2 or not.

By the way, in our case, if we set the X component of the legend's Location to some value using the ParentPercentage - this will not affect the horizontal dragging, but in case of parent panels docked to the left (dockPanel1.Dock = DockStyle.Left) we'll get the same sort of issue, but with the horizontal dragging affected.

Nevron Support
Posted 13 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 Victor,

Just a short note that we managed to replicate/fix the problem. It was caused by invalid parent size calculation when doing offset on nested panels that use the NRelativeUnit.ParentPercentage unit for location. The fix will be available in the next SP.



Best Regards,
Nevron Support Team



Viktor
Posted 13 Years Ago
View Quick Profile
Junior Member

Junior Member (11 reputation)Junior Member (11 reputation)Junior Member (11 reputation)Junior Member (11 reputation)Junior Member (11 reputation)Junior Member (11 reputation)Junior Member (11 reputation)Junior Member (11 reputation)Junior Member (11 reputation)

Group: Forum Members
Last Active: 9 Years Ago
Posts: 11, Visits: 10
Thank you! Looking forward to the SP.



Similar Topics


Reading This Topic