Profile Picture

Placing a gauge panel in a docked panel breaks tooltips and indicator dragging

Posted By Kevin Harrison 9 Years Ago

Placing a gauge panel in a docked panel breaks tooltips and indicator...

Author
Message
Kevin Harrison
Problem Posted 9 Years Ago
View Quick Profile
Supreme Being

Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 176, Visits: 1,865

I am populating an NChartControl with a title Label, subtitle Label and GaugePanel. Unlike all the examples, I want my gauge not to impinge into the title area as the size of the NChartControl is reduced. If I set the GaugePanel to Dock.Fill, then I lose the ability to centre the gauge within its panel.
The obvious answer is to place the GaugePanel within an NDockPanel which is set to Dock.Fill. This means the gauge maintains its central position within its panel.
However, once I do this, the Tooltip doesn't work and dragging of the indicator is no longer works. I suspect other tools are broken as well.
How do I achieve my goal?
Thanks
Kevin



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: Last Week
Posts: 3,054, Visits: 4,018
Hi Kevin,

Can you send us an example of the current configuration so that we can replicate the problem?

Best Regards,
Nevron Support Team



Kevin Harrison
Posted 9 Years Ago
View Quick Profile
Supreme Being

Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 176, Visits: 1,865
What do you mean by the current configuration?
I've done some experimenting. If I open the examples solution and add a host panel for the gauge in the Interactivity - Tooltips example, it all works as expected. This means there's something in my code causing the issue.
What is strange is, in my code, I've investigated what element the HitTest thinks I'm clicking on with and without a host panel for the gauge. Without a host panel the ChartElement is GaugeMarker, Axis etc. When I add a hosting panel and the tooltip and dragging doesn't work, then the ChartElement is ControlBackground for both the marker and axes on a linear gauge. On a radial gauge, I can get GaugePanel in many areas, but GaugeAxis when I'm over a label in the centre of the gauge. It seems the coordinate transformation has become confused?
All I've done is add the host panel!
NDockPanel gaugeHostPanel = new NDockPanel();
gaugeHostPanel.DockMargins = new NMarginsL(10, 10, 10, 10);
gaugeHostPanel.DockMode = PanelDockMode.Fill;
gaugePanel.BoundsMode = BoundsMode.Fit;
gaugeHostPanel.ChildPanels.Add(gaugePanel);
this.nevronControl.Panels.Add(gaugeHostPanel);

instead of:
this.nevronControl.Panels.Add(gaugePanel);





Tags
Kevin Harrison
Posted 9 Years Ago
View Quick Profile
Supreme Being

Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 176, Visits: 1,865
Here's the serialised info for the rendered gauges. Two pairs: NoHost and WithHost ( the latter with the nested panel)


Attachments
GaugeSerialisation.zip (565 views, 44.00 KB)
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: Last Week
Posts: 3,054, Visits: 4,018
Hi Kevin,

We could not replicate this - this is the code we tested with:

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

   NDockPanel gaugeHostPanel = new NDockPanel();
   gaugeHostPanel.DockMargins = new NMarginsL(10, 10, 10, 10);
   gaugeHostPanel.DockMode = PanelDockMode.Fill;

   NRadialGaugePanel radialGauge = new NRadialGaugePanel();
   radialGauge.Location = new NPointL(new NLength(10, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage));
   radialGauge.Size = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage));
   radialGauge.PaintEffect = new NGlassEffectStyle();
   radialGauge.BorderStyle = new NEdgeBorderStyle(BorderShape.Auto);
   radialGauge.BackgroundFillStyle = new NAdvancedGradientFillStyle(AdvancedGradientScheme.WhiteOnBlack, 0);

   // configure scale
   NLinearScaleConfigurator scale = ((NGaugeAxis)radialGauge.Axes[0]).ScaleConfigurator as NLinearScaleConfigurator;
   scale.SetPredefinedScaleStyle(PredefinedScaleStyle.PresentationNoStroke);
   scale.LabelFitModes = new LabelFitMode[0];
   scale.MinorTickCount = 3;
   scale.RulerStyle.FillStyle = new NColorFillStyle(Color.FromArgb(40, Color.White));
   scale.OuterMajorTickStyle.FillStyle = new NColorFillStyle(Color.Orange);
   scale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 12, FontStyle.Bold | FontStyle.Italic);
   scale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.White);

   NGaugeAxis m_Axis = (NGaugeAxis)radialGauge.Axes[0];

   NRangeIndicator indicator1 = new NRangeIndicator();
   indicator1.Value = 50;
   indicator1.FillStyle = new NColorFillStyle(Color.LightBlue);
   indicator1.StrokeStyle.Color = Color.DarkBlue;
   indicator1.EndWidth = new NLength(20);
   indicator1.AllowDragging = true;
   radialGauge.Indicators.Add(indicator1);

   NNeedleValueIndicator indicator2 = new NNeedleValueIndicator();
   indicator2.Value = 79;
   indicator2.Shape.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red);
   indicator2.Shape.StrokeStyle.Color = Color.Red;
   indicator2.AllowDragging = true;
   radialGauge.Indicators.Add(indicator2);
   radialGauge.SweepAngle = 270;

   NMarkerValueIndicator indicator3 = new NMarkerValueIndicator();
   indicator3.Value = 90;
   radialGauge.Indicators.Add(indicator3);

   nChartControl1.Controller.Tools.Add(new NTooltipTool());
   nChartControl1.Controller.Tools.Add(new NSelectorTool());
   nChartControl1.Controller.Tools.Add(new NIndicatorDragTool());

   indicator1.InteractivityStyle.Tooltip.Text = "Range Tooltip";
   indicator2.InteractivityStyle.Tooltip.Text = "Needle Tooltip";
   indicator3.InteractivityStyle.Tooltip.Text = "Marker Tooltip";
   m_Axis.InteractivityStyle.Tooltip.Text = "Scale Tooltip";


   radialGauge.BoundsMode = BoundsMode.Fit;
   gaugeHostPanel.ChildPanels.Add(radialGauge);
   this.nChartControl1.Panels.Add(gaugeHostPanel);

   nChartControl1.MouseDown += new MouseEventHandler(nChartControl1_MouseDown);
  }

  void nChartControl1_MouseDown(object sender, MouseEventArgs e)
  {     
   NHitTestResult result = nChartControl1.HitTest(e.X, e.Y);

  }

All interactive functionality - tooltips, hit testing and indicator dragging is working OK.


Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic