Dark Theme
Light Theme
Trading Articles
Article Categories
Article Tools
Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to
register in order to view the content of the threads and start contributing to our community.
It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Centering chart on the Y axis
Updated April 11, 2012
Top Posters
looks_one
Adamus
with 7 posts (9 thanks)
looks_two
sniffy
with 2 posts (5 thanks)
looks_3
ThatManFromTexas
with 1 posts (0 thanks)
looks_4
madLyfe
with 1 posts (1 thanks)
Best Posters
looks_one
sniffy
with 2.5 thanks per post
looks_two
Adamus
with 1.3 thanks per post
looks_3
madLyfe
with 1 thanks per post
looks_4
DavidHP
with 1 thanks per post
trending_up
7,966 views
thumb_up
16 thanks given
group
9 followers
forum
12 posts
attach_file
0 attachments
Centering chart on the Y axis
February 14th, 2012, 11:36 AM
London, UK
Experience: Beginner
Platform: NinjaTrader, home-grown Java
Broker: IB/IQFeed
Trading: EUR/USD
Posts: 1,085 since Dec 2010
Thanks Given: 471
Thanks Received: 789
I want to put a few common mouse-driven tasks that I often do into NinjaScript and execute them with one click on a button.
My most frequent task is to center the price on the Y axis because I use a fixed scale on my charts rather than allowing Ninjatrader to vary the Y axis according to the data shown.
I search all over futures.io (formerly BMT ) and NinjaTrader.com/support but I can't find anything conclusive.
So far I'm adding buttons to the chart trader and I've got one button to toggle the executions on and off, and I now need another code snippet to center the price on the Y axis.
Code
#region Using declarations
using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Resources;
using System.Windows.Forms;
using System.Collections;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Indicator;
using NinjaTrader.Gui.Chart;
#endregion
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Indicator
{
/// <summary>
/// Enter the description of your Indicator here
/// </summary>
[Description("Indicator to add chart trader buttons")]
public class ChartTraderExtra : Indicator
{
protected bool Initialized = false;
private Button toggleTradesButton = null;
private Button centrePriceButton = null;
public override void Dispose()
{
if (Initialized)
{
if (ChartControl != null)
{
Panel panel = (Panel) ChartControl.Controls["pnlChartTrader"];
if (panel != null
&& panel.Controls["ctrChartTraderControl"] != null
&& toggleTradesButton != null)
{
Control control = panel.Controls["ctrChartTraderControl"];
control.Controls.Remove(toggleTradesButton);
control.Controls.Remove(centrePriceButton);
toggleTradesButton.Click -= new EventHandler(toggleTrades_Click);
centrePriceButton.Click -= new EventHandler(centrePrice_Click);
}
}
}
}
protected virtual void OnInitializeBeforeStart()
{
CreateChartTraderButtons();
}
protected override void Initialize()
{
Overlay = true;
CalculateOnBarClose = true;
}
protected override void OnBarUpdate()
{
if (!Initialized)
{
OnInitializeBeforeStart();
Initialized = true;
Panel panel = (Panel) ChartControl.Controls["pnlChartTrader"];
if (false // remove "false" for debugging
&& panel != null
&& panel.Controls["ctrChartTraderControl"] != null)
{
Control control = panel.Controls["ctrChartTraderControl"];
for (int k = 0; k <= control.Controls.Count - 1; k++)
{
Control button = control.Controls[k];
string msg = button.Name
+ " L:" + button.Left
+ " T:" + button.Top
+ " H:" + button.Height
+ " W:" + button.Width;
Log(msg, NinjaTrader.Cbi.LogLevel.Alert);
}
}
}
}
protected void CreateChartTraderButtons()
{
if (ChartControl != null)
{
Panel panel = (Panel) ChartControl.Controls["pnlChartTrader"];
if (panel != null
&& panel.Controls["ctrChartTraderControl"] != null)
{
Control control = panel.Controls["ctrChartTraderControl"];
toggleTradesButton = new Button();
toggleTradesButton.Name = "toggleTrades";
toggleTradesButton.Text = "Toggle Trades";
toggleTradesButton.Height = 40;
toggleTradesButton.Width = 72;
toggleTradesButton.Left = 8;
toggleTradesButton.Top = 436;
toggleTradesButton.Click += new EventHandler(toggleTrades_Click);
control.Controls.Add(toggleTradesButton);
centrePriceButton = new Button();
centrePriceButton.Name = "centrePrice";
centrePriceButton.Text = "Centre Price";
centrePriceButton.Height = 40;
centrePriceButton.Width = 72;
centrePriceButton.Left = 88;
centrePriceButton.Top = 436;
centrePriceButton.Click += new EventHandler(centrePrice_Click);
control.Controls.Add(centrePriceButton);
}
}
}
private void toggleTrades_Click(object sender, EventArgs e)
{
//Log("toggle trades!", NinjaTrader.Cbi.LogLevel.Alert);
if (ChartControl.BarsArray[0].BarsData.PlotExecutions ==
ChartExecutionStyle.DoNotPlot)
{
ChartControl.BarsArray[0].BarsData.PlotExecutions =
ChartExecutionStyle.MarkersOnly;
}
else if (ChartControl.BarsArray[0].BarsData.PlotExecutions ==
ChartExecutionStyle.MarkersOnly)
{
ChartControl.BarsArray[0].BarsData.PlotExecutions =
ChartExecutionStyle.TextAndMarker;
}
else if (ChartControl.BarsArray[0].BarsData.PlotExecutions ==
ChartExecutionStyle.TextAndMarker)
{
ChartControl.BarsArray[0].BarsData.PlotExecutions =
ChartExecutionStyle.DoNotPlot;
}
}
private void centrePrice_Click(object sender, EventArgs e)
{
Log("centre price! - " + ChartControl.ChartPanel., NinjaTrader.Cbi.LogLevel.Alert);
}
}
}
#region NinjaScript generated code. Neither change nor remove.
// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
public partial class Indicator : IndicatorBase
{
private ChartTraderExtra[] cacheChartTraderExtra = null;
private static ChartTraderExtra checkChartTraderExtra = new ChartTraderExtra();
/// <summary>
/// Indicator to add chart trader buttons
/// </summary>
/// <returns></returns>
public ChartTraderExtra ChartTraderExtra()
{
return ChartTraderExtra(Input);
}
/// <summary>
/// Indicator to add chart trader buttons
/// </summary>
/// <returns></returns>
public ChartTraderExtra ChartTraderExtra(Data.IDataSeries input)
{
if (cacheChartTraderExtra != null)
for (int idx = 0; idx < cacheChartTraderExtra.Length; idx++)
if (cacheChartTraderExtra[idx].EqualsInput(input))
return cacheChartTraderExtra[idx];
lock (checkChartTraderExtra)
{
if (cacheChartTraderExtra != null)
for (int idx = 0; idx < cacheChartTraderExtra.Length; idx++)
if (cacheChartTraderExtra[idx].EqualsInput(input))
return cacheChartTraderExtra[idx];
ChartTraderExtra indicator = new ChartTraderExtra();
indicator.BarsRequired = BarsRequired;
indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
indicator.Input = input;
Indicators.Add(indicator);
indicator.SetUp();
ChartTraderExtra[] tmp = new ChartTraderExtra[cacheChartTraderExtra == null ? 1 : cacheChartTraderExtra.Length + 1];
if (cacheChartTraderExtra != null)
cacheChartTraderExtra.CopyTo(tmp, 0);
tmp[tmp.Length - 1] = indicator;
cacheChartTraderExtra = tmp;
return indicator;
}
}
}
}
// This namespace holds all market analyzer column definitions and is required. Do not change it.
namespace NinjaTrader.MarketAnalyzer
{
public partial class Column : ColumnBase
{
/// <summary>
/// Indicator to add chart trader buttons
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.ChartTraderExtra ChartTraderExtra()
{
return _indicator.ChartTraderExtra(Input);
}
/// <summary>
/// Indicator to add chart trader buttons
/// </summary>
/// <returns></returns>
public Indicator.ChartTraderExtra ChartTraderExtra(Data.IDataSeries input)
{
return _indicator.ChartTraderExtra(input);
}
}
}
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
public partial class Strategy : StrategyBase
{
/// <summary>
/// Indicator to add chart trader buttons
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.ChartTraderExtra ChartTraderExtra()
{
return _indicator.ChartTraderExtra(Input);
}
/// <summary>
/// Indicator to add chart trader buttons
/// </summary>
/// <returns></returns>
public Indicator.ChartTraderExtra ChartTraderExtra(Data.IDataSeries input)
{
if (InInitialize && input == null)
throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");
return _indicator.ChartTraderExtra(input);
}
}
}
#endregion
You can discover what your enemy fears most by observing the means he uses to frighten you.
Can you help answer these questions from other members on NexusFi?
Best Threads (Most Thanked) in the last 7 days on NexusFi
February 14th, 2012, 12:07 PM
Des Moines, Iowa
Experience: None
Platform: Ninja, TOS
Broker: AMP/CQG, TOS
Trading: CL, TF, GC
Posts: 1,641 since Feb 2011
Thanks Given: 9,220
Thanks Received: 1,021
Adamus
I want to put a few common mouse-driven tasks that I often do into NinjaScript and execute them with one click on a button.
My most frequent task is to center the price on the Y axis because I use a fixed
scale on my charts rather than allowing
Ninjatrader to vary the Y axis according to the data shown.
I search all over nexusfi.com (formerly
BMT ) and NinjaTrader.com/support but I can't find anything conclusive.
So far I'm adding buttons to the chart trader and I've got one button to toggle the executions on and off, and I now need another code snippet to center the price on the Y axis.
Code
#region Using declarations
using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Resources;
using System.Windows.Forms;
using System.Collections;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Indicator;
using NinjaTrader.Gui.Chart;
#endregion
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Indicator
{
/// <summary>
/// Enter the description of your Indicator here
/// </summary>
[Description("Indicator to add chart trader buttons")]
public class ChartTraderExtra : Indicator
{
protected bool Initialized = false;
private Button toggleTradesButton = null;
private Button centrePriceButton = null;
public override void Dispose()
{
if (Initialized)
{
if (ChartControl != null)
{
Panel panel = (Panel) ChartControl.Controls["pnlChartTrader"];
if (panel != null
&& panel.Controls["ctrChartTraderControl"] != null
&& toggleTradesButton != null)
{
Control control = panel.Controls["ctrChartTraderControl"];
control.Controls.Remove(toggleTradesButton);
control.Controls.Remove(centrePriceButton);
toggleTradesButton.Click -= new EventHandler(toggleTrades_Click);
centrePriceButton.Click -= new EventHandler(centrePrice_Click);
}
}
}
}
protected virtual void OnInitializeBeforeStart()
{
CreateChartTraderButtons();
}
protected override void Initialize()
{
Overlay = true;
CalculateOnBarClose = true;
}
protected override void OnBarUpdate()
{
if (!Initialized)
{
OnInitializeBeforeStart();
Initialized = true;
Panel panel = (Panel) ChartControl.Controls["pnlChartTrader"];
if (false // remove "false" for debugging
&& panel != null
&& panel.Controls["ctrChartTraderControl"] != null)
{
Control control = panel.Controls["ctrChartTraderControl"];
for (int k = 0; k <= control.Controls.Count - 1; k++)
{
Control button = control.Controls[k];
string msg = button.Name
+ " L:" + button.Left
+ " T:" + button.Top
+ " H:" + button.Height
+ " W:" + button.Width;
Log(msg, NinjaTrader.Cbi.LogLevel.Alert);
}
}
}
}
protected void CreateChartTraderButtons()
{
if (ChartControl != null)
{
Panel panel = (Panel) ChartControl.Controls["pnlChartTrader"];
if (panel != null
&& panel.Controls["ctrChartTraderControl"] != null)
{
Control control = panel.Controls["ctrChartTraderControl"];
toggleTradesButton = new Button();
toggleTradesButton.Name = "toggleTrades";
toggleTradesButton.Text = "Toggle Trades";
toggleTradesButton.Height = 40;
toggleTradesButton.Width = 72;
toggleTradesButton.Left = 8;
toggleTradesButton.Top = 436;
toggleTradesButton.Click += new EventHandler(toggleTrades_Click);
control.Controls.Add(toggleTradesButton);
centrePriceButton = new Button();
centrePriceButton.Name = "centrePrice";
centrePriceButton.Text = "Centre Price";
centrePriceButton.Height = 40;
centrePriceButton.Width = 72;
centrePriceButton.Left = 88;
centrePriceButton.Top = 436;
centrePriceButton.Click += new EventHandler(centrePrice_Click);
control.Controls.Add(centrePriceButton);
}
}
}
private void toggleTrades_Click(object sender, EventArgs e)
{
//Log("toggle trades!", NinjaTrader.Cbi.LogLevel.Alert);
if (ChartControl.BarsArray[0].BarsData.PlotExecutions ==
ChartExecutionStyle.DoNotPlot)
{
ChartControl.BarsArray[0].BarsData.PlotExecutions =
ChartExecutionStyle.MarkersOnly;
}
else if (ChartControl.BarsArray[0].BarsData.PlotExecutions ==
ChartExecutionStyle.MarkersOnly)
{
ChartControl.BarsArray[0].BarsData.PlotExecutions =
ChartExecutionStyle.TextAndMarker;
}
else if (ChartControl.BarsArray[0].BarsData.PlotExecutions ==
ChartExecutionStyle.TextAndMarker)
{
ChartControl.BarsArray[0].BarsData.PlotExecutions =
ChartExecutionStyle.DoNotPlot;
}
}
private void centrePrice_Click(object sender, EventArgs e)
{
Log("centre price! - " + ChartControl.ChartPanel., NinjaTrader.Cbi.LogLevel.Alert);
}
}
}
#region NinjaScript generated code. Neither change nor remove.
// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
public partial class Indicator : IndicatorBase
{
private ChartTraderExtra[] cacheChartTraderExtra = null;
private static ChartTraderExtra checkChartTraderExtra = new ChartTraderExtra();
/// <summary>
/// Indicator to add chart trader buttons
/// </summary>
/// <returns></returns>
public ChartTraderExtra ChartTraderExtra()
{
return ChartTraderExtra(Input);
}
/// <summary>
/// Indicator to add chart trader buttons
/// </summary>
/// <returns></returns>
public ChartTraderExtra ChartTraderExtra(Data.IDataSeries input)
{
if (cacheChartTraderExtra != null)
for (int idx = 0; idx < cacheChartTraderExtra.Length; idx++)
if (cacheChartTraderExtra[idx].EqualsInput(input))
return cacheChartTraderExtra[idx];
lock (checkChartTraderExtra)
{
if (cacheChartTraderExtra != null)
for (int idx = 0; idx < cacheChartTraderExtra.Length; idx++)
if (cacheChartTraderExtra[idx].EqualsInput(input))
return cacheChartTraderExtra[idx];
ChartTraderExtra indicator = new ChartTraderExtra();
indicator.BarsRequired = BarsRequired;
indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
indicator.Input = input;
Indicators.Add(indicator);
indicator.SetUp();
ChartTraderExtra[] tmp = new ChartTraderExtra[cacheChartTraderExtra == null ? 1 : cacheChartTraderExtra.Length + 1];
if (cacheChartTraderExtra != null)
cacheChartTraderExtra.CopyTo(tmp, 0);
tmp[tmp.Length - 1] = indicator;
cacheChartTraderExtra = tmp;
return indicator;
}
}
}
}
// This namespace holds all market analyzer column definitions and is required. Do not change it.
namespace NinjaTrader.MarketAnalyzer
{
public partial class Column : ColumnBase
{
/// <summary>
/// Indicator to add chart trader buttons
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.ChartTraderExtra ChartTraderExtra()
{
return _indicator.ChartTraderExtra(Input);
}
/// <summary>
/// Indicator to add chart trader buttons
/// </summary>
/// <returns></returns>
public Indicator.ChartTraderExtra ChartTraderExtra(Data.IDataSeries input)
{
return _indicator.ChartTraderExtra(input);
}
}
}
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
public partial class Strategy : StrategyBase
{
/// <summary>
/// Indicator to add chart trader buttons
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.ChartTraderExtra ChartTraderExtra()
{
return _indicator.ChartTraderExtra(Input);
}
/// <summary>
/// Indicator to add chart trader buttons
/// </summary>
/// <returns></returns>
public Indicator.ChartTraderExtra ChartTraderExtra(Data.IDataSeries input)
{
if (InInitialize && input == null)
throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");
return _indicator.ChartTraderExtra(input);
}
}
}
#endregion
not sure im on the right side of the topic here, but have you checked this work out?
dont believe anything you hear and only half of what you see
¯\_(ツ)_/¯
(╯°□°)╯︵ ┻━┻
February 14th, 2012, 01:57 PM
London, UK
Experience: Beginner
Platform: NinjaTrader, home-grown Java
Broker: IB/IQFeed
Trading: EUR/USD
Posts: 1,085 since Dec 2010
Thanks Given: 471
Thanks Received: 789
Man, that is a big piece of programming. The answer's bound to be in there somewhere
You can discover what your enemy fears most by observing the means he uses to frighten you.
February 14th, 2012, 05:42 PM
London, UK
Experience: Beginner
Platform: NinjaTrader, home-grown Java
Broker: IB/IQFeed
Trading: EUR/USD
Posts: 1,085 since Dec 2010
Thanks Given: 471
Thanks Received: 789
Nope, can't figure it from that. Too much stuff going on to be able to work it out there.
You can discover what your enemy fears most by observing the means he uses to frighten you.
February 28th, 2012, 07:23 AM
London, UK
Experience: Beginner
Platform: NinjaTrader, home-grown Java
Broker: IB/IQFeed
Trading: EUR/USD
Posts: 1,085 since Dec 2010
Thanks Given: 471
Thanks Received: 789
Finally figured it out thanks due to @devdas
Code
this . ChartControl . YAxisRangeTypeRight = YAxisRangeType . Fixed ; double yAxisSize = this . ChartControl . FixedPanelMaxRight - this . ChartControl . FixedPanelMinRight ; this . ChartControl . FixedPanelMaxRight = Close [ 0 ] + ( yAxisSize / 2 ); this . ChartControl . FixedPanelMinRight = Close [ 0 ] - ( yAxisSize / 2 );
You can discover what your enemy fears most by observing the means he uses to frighten you.
March 21st, 2012, 07:54 AM
London, UK
Experience: Beginner
Platform: NinjaTrader, home-grown Java
Broker: IB/IQFeed
Trading: EUR/USD
Posts: 1,085 since Dec 2010
Thanks Given: 471
Thanks Received: 789
Still not perfected the indicator yet - I have a slight bug with the code for toggling the show-trades on and off. When I click my button, it executes the script, but sometimes and I haven't figured out when it does and when it doesn't, the chart doesn't change unless I move my mouse over the chart.
If I can get this fixed, it'll be sorted and I can upload the indie to the upload area.
You can discover what your enemy fears most by observing the means he uses to frighten you.
March 22nd, 2012, 05:35 AM
London, UK
Experience: Beginner
Platform: NinjaTrader, home-grown Java
Broker: IB/IQFeed
Trading: EUR/USD
Posts: 1,085 since Dec 2010
Thanks Given: 471
Thanks Received: 789
This is the code that occasionally doesn't work until I mouse-over the chart:
Code
private void CentrePrice_Click ( object sender , EventArgs e ) { this . ChartControl . YAxisRangeTypeRight = YAxisRangeType . Fixed ; double yAxisSize = this . ChartControl . FixedPanelMaxRight - this . ChartControl . FixedPanelMinRight ; this . ChartControl . FixedPanelMaxRight = Close [ CurrentBar - this . LastBarIndexPainted ] + ( yAxisSize / 2 ); this . ChartControl . FixedPanelMinRight = Close [ CurrentBar - this . LastBarIndexPainted ] - ( yAxisSize / 2 ); } protected override void OnBarUpdate () { if (! Initialized ) { centrePriceButton = new Button (); Control control = panel . Controls [ "ctrChartTraderControl" ]; control . Controls . Add ( centrePriceButton ); centrePriceButton . Click += new EventHandler ( CentrePrice_Click ); Initialized = true ; } }
Often it works immediately - sometimes it feels like it needs a tick to come through to work - and sometimes I have to move the mouse over to make it work.
Can anyone offer some good advice?
You can discover what your enemy fears most by observing the means he uses to frighten you.
March 22nd, 2012, 06:12 AM
Isla Mujeres, MX
Legendary Market Wizard
Experience: Advanced
Platform: NinjaTrader
Broker: Ninjatrader / Optimus Futures / AmpFutures
Trading: ES / 6E / 6B / CL
Frequency: Every few days
Duration: Minutes
Posts: 1,621 since Aug 2009
Thanks Given: 11,354
Thanks Received: 2,752
Adamus
Can anyone offer some good advice?
Have you checked THIS thread?
Maybe it can give you some ideas.
It is about setting the chart to a fixed scroll amount.
Rejoice in the Thunderstorms of Life . . .
Knowing it's not about Clouds or Wind . . .
But Learning to Dance in the Rain ! ! !
March 22nd, 2012, 05:10 PM
alask
Posts: 7 since Oct 2009
Thanks Given: 0
Thanks Received: 5
Adamus
This is the code that occasionally doesn't work until I mouse-over the chart:
Code
private void CentrePrice_Click ( object sender , EventArgs e )
{
this . ChartControl . YAxisRangeTypeRight = YAxisRangeType . Fixed ;
double yAxisSize = this . ChartControl . FixedPanelMaxRight -
this . ChartControl . FixedPanelMinRight ;
this . ChartControl . FixedPanelMaxRight =
Close [ CurrentBar - this . LastBarIndexPainted ] + ( yAxisSize / 2 );
this . ChartControl . FixedPanelMinRight =
Close [ CurrentBar - this . LastBarIndexPainted ] - ( yAxisSize / 2 );
}
protected override void OnBarUpdate ()
{
if (! Initialized )
{
centrePriceButton = new Button ();
Control control = panel . Controls [ "ctrChartTraderControl" ];
control . Controls . Add ( centrePriceButton );
centrePriceButton . Click += new EventHandler ( CentrePrice_Click );
Initialized = true ;
}
}
Often it works immediately - sometimes it feels like it needs a tick to come through to work - and sometimes I have to move the mouse over to make it work.
Can anyone offer some good advice?
this works for me
#region Event Handlers
private void centrePrice_Click(object sender, EventArgs e)
{
this.ChartControl.YAxisRangeTypeRight = YAxisRangeType.Fixed;
double yAxisSize = this.ChartControl.FixedPanelMaxRight -
this.ChartControl.FixedPanelMinRight;
this.ChartControl.FixedPanelMaxRight = Close[0] + (yAxisSize / 2);
this.ChartControl.FixedPanelMinRight = Close[0] - (yAxisSize / 2);
// force repaint so we dont have to wait for another event
ChartControl.ChartPanel.Invalidate(); // <<<<<<--------------------
}
#endregion Event Handlers
Last Updated on April 11, 2012