Profile Picture

add radial gauge to panel

Posted By Adrian Simionescu 13 Years Ago
Author
Message
Adrian Simionescu
Posted 13 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: Forum Members
Last Active: 13 Years Ago
Posts: 2, Visits: 1
I modified the code from your message to simulate my code that didn’t work:

NChartControl chartControl;
NNeedleValueIndicator m_Needle;
NChartCommandBarsManager commandBarsManager = new NChartCommandBarsManager();
commandBarsManager.ParentControl = this;

System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(this.GetType());
chartControl = new NChartControl();
chartControl.AutoRefresh = true;
chartControl.BackColor = System.Drawing.SystemColors.Control;
chartControl.Dock = System.Windows.Forms.DockStyle.Fill;
chartControl.InputKeys = new System.Windows.Forms.Keys[0];
chartControl.Location = new System.Drawing.Point(0, 0);
chartControl.Name = "chartControl";
chartControl.Size = new System.Drawing.Size(806, 503);
chartControl.State = ((Nevron.Chart.WinForm.NState)(resources.GetObject("chartControl.State")));
this.Controls.Add(chartControl);
chartControl.BringToFront();
chartControl.Charts.Clear();
chartControl.Legends.Clear();
chartControl.Labels.Clear();
commandBarsManager.ChartControl = chartControl;

NRadialGaugePanel gaugePanel = new NRadialGaugePanel();
m_Needle = new NNeedleValueIndicator();
m_Needle.Value = 0;
m_Needle.DampeningInterval = 50;
m_Needle.DampeningSteps = 10;
m_Needle.EnableDampening = true;
gaugePanel.Indicators.Add(m_Needle);

chartControl.AutoRefresh = true;

NDockPanel panel = new NDockPanel();
panel.Dock = DockStyle.Top;
panel.Size = new NSizeL(0, 400);
panel.ChildPanels.Add(gaugePanel);

//chartControl.Panels.Add(panel);
m_Needle.Value = 80;

chartControl.Panels.Add(panel); //must be moved before assigning the indicator value

chartControl.Refresh();

In my code I assigned the indicator value before the line chartControl.Panels.Add(panel);.
In order to make value dampening work, I modified my code and added the NDockPanel to NchartControl.Panels before the assignment of the indicator value, as in the commented line.

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

Hello Adrian,

We were unable to reproduce the issue based on your description. The code snipped bellow demonstrates a gauge placed in an NDockPanel – our tests did not show any problems with dampening.

Timer m_Timer;

double m_Angle;

NRangeIndicator m_RangeInidcator;

NNeedleValueIndicator m_Needle;

Random rand = new Random();

 

 

NChartCommandBarsManager commandBarsManager = new NChartCommandBarsManager();

commandBarsManager.ParentControl = this;

commandBarsManager.ChartControl = nChartControl1;

 

nChartControl1.Charts.Clear();     

 

NRadialGaugePanel gaugePanel = new NRadialGaugePanel();

 

m_RangeInidcator = new NRangeIndicator();

m_RangeInidcator.DampeningInterval = 50;

m_RangeInidcator.DampeningSteps = 10;

m_RangeInidcator.EnableDampening = true;

m_RangeInidcator.Value = 50;

m_RangeInidcator.BeginWidth = new NLength(10);

m_RangeInidcator.EndWidth = new NLength(20);

 

gaugePanel.Indicators.Add(m_RangeInidcator);

 

m_Needle = new NNeedleValueIndicator();

m_Needle.Value = 40;

m_Needle.DampeningInterval = 50;

m_Needle.DampeningSteps = 10;

m_Needle.EnableDampening = true;

gaugePanel.Indicators.Add(m_Needle);

 

nChartControl1.AutoRefresh = true;

 

NDockPanel panel = new NDockPanel();

panel.Dock = DockStyle.Top;

panel.Size = new NSizeL(0, 400);

panel.ChildPanels.Add(gaugePanel);

 

nChartControl1.Panels.Add(panel);

 

m_Timer = new Timer();

m_Timer.Interval = 200;

m_Timer.Start();

m_Timer.Tick += new EventHandler(m_Timer_Tick);

 

 

void m_Timer_Tick(object sender, EventArgs e)

{

      m_Angle += Math.PI / 180.0;

 

      rangeInidcator.Value = 50 + Math.Sin(m_Angle) * (20 + rand.Next(30));

      needle.Value = 50 + Math.Sin(m_Angle) * (30 + rand.Next(20));

 

      nChartControl1.Refresh();

 

}

Best Regards,
Nevron Support Team



Adrian Simionescu
Posted 13 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: Forum Members
Last Active: 13 Years Ago
Posts: 2, Visits: 1

We use in our soft application the Nevron charts and I encountered the following situation: the value dampening for radial gauges does not work when the gauge is added to the ChildPanels collection of an object of type NDockPanel which is added to the Panels collection of the ChartControl member of the NChartCommandBarsManager object.

I observed that the value dampening works when the radial gauge is added to the Panels collection of the object ChartControl member of the NChartCommandBarsManager object.

 

What is the sollution to activate the value dampening when the radial gauge is added to an object of type NDockPanel?





Similar Topics


Reading This Topic