CHart axis area Clipping
CHart axis area Clipping
Greetings,
I have a chart with multiple axes and in the top axis I have stock data and many trend lines drawn ... when I zoom in to my stock data the trend lines (drawlines) render on the custom axis. see image. Is there a way to set up a clipping region (or whatever clipping mechanism) to stop drawlines in the top axis from 'overflowing' onto my custom axis.
I have a chart with multiple axes and in the top axis I have stock data and many trend lines drawn ... when I zoom in to my stock data the trend lines (drawlines) render on the custom axis. see image. Is there a way to set up a clipping region (or whatever clipping mechanism) to stop drawlines in the top axis from 'overflowing' onto my custom axis.
--------------------
Cheers Phil.
Cheers Phil.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: CHart axis area Clipping
Hi Phil,
You can try doing something like in the All Features\Welcome !\Axes\Opaque zones example in the features demo available at TeeChart's program group.
You can try doing something like in the All Features\Welcome !\Axes\Opaque zones example in the features demo available at TeeChart's program group.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Chart axis area Clipping
Greetings,
That didn't work for me ... the example hooks up before and afterdraw event handlers to a Series .. my series are fine they only draw within their axes, its the drawlines that are getting drawn every where and they dont have before and after draw events.
We have the source code .. could we clip inside the Drawline.cs class ?
in any case below is the code I put in the before_Draw .. I guess it sets up a clipping region for each series per axis .. but drawlines seem to ignore it.
That didn't work for me ... the example hooks up before and afterdraw event handlers to a Series .. my series are fine they only draw within their axes, its the drawlines that are getting drawn every where and they dont have before and after draw events.
We have the source code .. could we clip inside the Drawline.cs class ?
in any case below is the code I put in the before_Draw .. I guess it sets up a clipping region for each series per axis .. but drawlines seem to ignore it.
Code: Select all
private void StockChart_BeforeDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
if (sender.GetType() == typeof(Series))
{
Rectangle rect = StockChart.Chart.ChartRect;
int end = rect.Right;
int start = rect.Left;
Series s = (Series)sender;
//int left = s.GetHorizAxis.IStartPos;
//int right = s.GetHorizAxis.IEndPos;
int top = s.GetVertAxis.IStartPos;
int bottom = s.GetVertAxis.IEndPos;
StockChart.Graphics3D.ClipRectangle(start, top, end, bottom);
}
}
--------------------
Cheers Phil.
Cheers Phil.
Re: CHart axis area Clipping
Hello Phil,
I think that you need assign your DrawLine of determinate series. You can do something as next example that works fine here with last version of TeeChart.Net:
Could you tell us if previous code works as you want?
I hope will helps.
Thanks,
I think that you need assign your DrawLine of determinate series. You can do something as next example that works fine here with last version of TeeChart.Net:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
Steema.TeeChart.Tools.DrawLine drawline,drawline1;
Steema.TeeChart.Axis axes1;
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
tChart1.Aspect.ClipPoints = false;
Steema.TeeChart.Styles.Line series1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
Steema.TeeChart.Styles.Line series2 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
series1.FillSampleValues();
series2.FillSampleValues();
series2.VertAxis = Steema.TeeChart.Styles.VerticalAxis.Left;
axes1 = new Steema.TeeChart.Axis();
tChart1.Axes.Custom.Add(axes1);
axes1.AxisPen.Color = Color.Red;
series1.CustomVertAxis = axes1;
tChart1.Axes.Left.StartPosition = 0;
tChart1.Axes.Left.EndPosition = 50;
axes1.StartPosition = 50;
axes1.EndPosition = 100;
axes1.Automatic = true;
//DrawLines
drawline = new Steema.TeeChart.Tools.DrawLine(tChart1.Chart);
drawline1 = new Steema.TeeChart.Tools.DrawLine(tChart1.Chart);
drawline.Active = true;
drawline.Series = series1;
drawline1.Series = series2;
//Series1
series1.AfterDrawValues = new Steema.TeeChart.PaintChartEventHandler(series1_AfterDrawValues);
series1.BeforeDrawValues = new Steema.TeeChart.PaintChartEventHandler(series1_BeforeDrawValues);
//Series2
series2.AfterDrawValues =new Steema.TeeChart.PaintChartEventHandler(series1_AfterDrawValues);
series2.BeforeDrawValues =new Steema.TeeChart.PaintChartEventHandler(series1_BeforeDrawValues);
drawline.NewLine = new Steema.TeeChart.Tools.DrawLineEventHandler(drawline_NewLine);
drawline1.NewLine = new Steema.TeeChart.Tools.DrawLineEventHandler(drawline1_NewLine);
tChart1.Draw();
}
void drawline1_NewLine(Steema.TeeChart.Tools.DrawLine sender)
{
drawline1.EnableDraw = false;
}
void drawline_NewLine(Steema.TeeChart.Tools.DrawLine sender)
{
drawline.EnableDraw = false;
}
void series1_BeforeDrawValues(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
Steema.TeeChart.Styles.Series s = sender as Steema.TeeChart.Styles.Series;
int left = s.GetHorizAxis.IStartPos;
int right = s.GetHorizAxis.IEndPos;
int top = s.GetVertAxis.IStartPos;
int bottom = s.GetVertAxis.IEndPos;
tChart1.Graphics3D.ClipRectangle(left, top, right, bottom);
}
void series1_AfterDrawValues(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
tChart1.Graphics3D.ClearClipRegions();
}
I hope will helps.
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: CHart axis area Clipping
Hi Sandra,
No it didnt work for me .. although its different than last time ... I get a clippign region this time although its not where it should be and it doesnt change ... essentially now I have a 2/3 of the screen that I cant draw on .. see below picture. The red circles show where I'm being clipped .. which is about half the chart including the custom axis .. and I can still overflow a drawline onto the custom axis. This is my Before_draw Method.
The debug code is showing me that it is calculating what look like the correct values for a region .. StockChart.Graphics3D.ClearClipRegions(); is getting called in the Afterdraw event.
This is me setting up the Series and drawlines
It seems to be totally ignoring the ClipRectangle values that are getting created in the Before Draw Event. I have no idea what values it must be using ...
No it didnt work for me .. although its different than last time ... I get a clippign region this time although its not where it should be and it doesnt change ... essentially now I have a 2/3 of the screen that I cant draw on .. see below picture. The red circles show where I'm being clipped .. which is about half the chart including the custom axis .. and I can still overflow a drawline onto the custom axis. This is my Before_draw Method.
Code: Select all
private void StockChart_BeforeDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
if (sender.GetType() == typeof(Candle) || sender.GetType() == typeof(Line))
{
Rectangle rect = StockChart.Chart.ChartRect;
int end = rect.Right;
int start = rect.Left;
int Top = rect.Top;
int Bottom = rect.Bottom;
Debug.Print("Rect: " + " l: " + start.ToString() + " t: " + Top.ToString() + " r: " + end.ToString() + " b: " + Bottom.ToString());
Series s = sender as Series;
int left = s.GetHorizAxis.IStartPos;
int right = s.GetHorizAxis.IEndPos;
int top = s.GetVertAxis.IStartPos;
int bottom = s.GetVertAxis.IEndPos;
StockChart.Graphics3D.ClipRectangle(left, top, right, bottom);
Debug.Print("Series:" + s.Title + " l: " + left.ToString() + " t: " + top.ToString() + " r: " + right.ToString() + " b: " + bottom.ToString());
Debug.Print("-------------------------------------------------------");
}
}
This is me setting up the Series and drawlines
Code: Select all
foreach (Series s in StockChart.Series)
{
s.AfterDrawValues += new PaintChartEventHandler(StockChart_AfterDraw);
s.BeforeDrawValues += new PaintChartEventHandler(StockChart_BeforeDraw);
}
((DrawLine)theTool).Series = StockChart.Series[0];
--------------------
Cheers Phil.
Cheers Phil.
Re: CHart axis area Clipping
Hello Phil,
Could you please, send us a simple project, because we can try to find a good solution for you here?
Thanks,
Could you please, send us a simple project, because we can try to find a good solution for you here?
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: CHart axis area Clipping
Here is the first problem I came up against
remove the line "Drawline.Series = candles" and there is no clipping at all.
it happens in this code
private void btn_DrawLine2_Click(object sender, EventArgs e)
{
DrawLine drawline = new DrawLine(tChart1.Chart);
drawline.Series = Candles; <================================== when I assign it a series I get the above behaviour.
drawline.Pen.Color = Color.Red;
drawline.Pen.Width = 2;
drawline.EnableDraw = true;
}
you can replicate by hitting the drawline button and dragging across the screen ... it will clip for no apparent reason.remove the line "Drawline.Series = candles" and there is no clipping at all.
it happens in this code
private void btn_DrawLine2_Click(object sender, EventArgs e)
{
DrawLine drawline = new DrawLine(tChart1.Chart);
drawline.Series = Candles; <================================== when I assign it a series I get the above behaviour.
drawline.Pen.Color = Color.Red;
drawline.Pen.Width = 2;
drawline.EnableDraw = true;
}
- Attachments
-
- Sandbox.zip
- (279.22 KiB) Downloaded 460 times
--------------------
Cheers Phil.
Cheers Phil.
Re: CHart axis area Clipping
Hello Phil,
I couldn't reproduce your problem using last maintenance release of 28 of September. Please, download last version of TeeChart.Net and try again if your problem appears. If your problem after upgrade still appears, please send us a simple project, because we can reproduce your problem here.
Thanks,
I couldn't reproduce your problem using last maintenance release of 28 of September. Please, download last version of TeeChart.Net and try again if your problem appears. If your problem after upgrade still appears, please send us a simple project, because we can reproduce your problem here.
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: CHart axis area Clipping
Looking through the bug fixes, [TF02015039] When Series property of DrawLine Tool assigned lines were erroneously clipped. Fixed.
That looks like my problem ... however when I log into the download site with any of the licences we have I cannot find the source code version ...
Where do I find said source code version (I've added an extra class to the source code we have, so I can just drop it into (fingers crossed) a newer version.)
That looks like my problem ... however when I log into the download site with any of the licences we have I cannot find the source code version ...
Where do I find said source code version (I've added an extra class to the source code we have, so I can just drop it into (fingers crossed) a newer version.)
--------------------
Cheers Phil.
Cheers Phil.
Re: CHart axis area Clipping
Hello Phil,
I download last version of TeeChart 2010 Source Code (TeeChartNetSrc_4.1.2010.09280), problem doesn't appear here and drawlineTool works fine for me. Are you using this version?
Thanks,
I download last version of TeeChart 2010 Source Code (TeeChartNetSrc_4.1.2010.09280), problem doesn't appear here and drawlineTool works fine for me. Are you using this version?
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: CHart axis area Clipping
No I havent downloaded that ... I cant find it in the list and I KNOW that at least one of our licences includes source code (thus why I have downloaded it once)
I can see all the Binaries and I've downloaded the latest one .. but I and a collegue have looked until our eyes have popped from our heads ... all we see is the gazillion versions of the binaries ... nothing with that magic "src" in the title ...
I'll have another look to confirm I'm not mad ...
I can see all the Binaries and I've downloaded the latest one .. but I and a collegue have looked until our eyes have popped from our heads ... all we see is the gazillion versions of the binaries ... nothing with that magic "src" in the title ...
I'll have another look to confirm I'm not mad ...
--------------------
Cheers Phil.
Cheers Phil.
Re: CHart axis area Clipping
Hello Phil,
Ok. Please, contact our Sales Dept. at sales at steema dot com for get your number of license of TeeChart2010 Source code and then try again to download upgrade version . If you have more problems please let me know.
Thanks,
Ok. Please, contact our Sales Dept. at sales at steema dot com for get your number of license of TeeChart2010 Source code and then try again to download upgrade version . If you have more problems please let me know.
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: CHart axis area Clipping
Greetings,
OK sorted out the license issue, downloaded the latest Source code, dropped it into the Solution and then added the above supplied code and now clipping works !!! YAY I'm in clipping paradise
An aside question though ... the Drawlines are now much slower than before, wheras before I could click and drag the mouse in real time and the Drawline would drawto the mouse position instantly ... now the line lags waaaaaaaaaaaay behind the mouse ... I have branched copies of my solution .. TeeChart 4.0 version is fine .. TeeChart 4.1 is 1/3 of the speed .. have you noticed any speed changes in drawing the DrawLines ???
Cheers Phil.
OK sorted out the license issue, downloaded the latest Source code, dropped it into the Solution and then added the above supplied code and now clipping works !!! YAY I'm in clipping paradise
An aside question though ... the Drawlines are now much slower than before, wheras before I could click and drag the mouse in real time and the Drawline would drawto the mouse position instantly ... now the line lags waaaaaaaaaaaay behind the mouse ... I have branched copies of my solution .. TeeChart 4.0 version is fine .. TeeChart 4.1 is 1/3 of the speed .. have you noticed any speed changes in drawing the DrawLines ???
Cheers Phil.
--------------------
Cheers Phil.
Cheers Phil.
Re: CHart axis area Clipping
Hello Phil,
Thanks
I am glad that now you are in clipping paradise .OK sorted out the license issue, downloaded the latest Source code, dropped it into the Solution and then added the above supplied code and now clipping works !!! YAY I'm in clipping paradise
Can you please, tell us exactly number of version 4.0 is faster than version last version 4.1?An aside question though ... the Drawlines are now much slower than before, wheras before I could click and drag the mouse in real time and the Drawline would drawto the mouse position instantly ... now the line lags waaaaaaaaaaaay behind the mouse ... I have branched copies of my solution .. TeeChart 4.0 version is fine .. TeeChart 4.1 is 1/3 of the speed .. have you noticed any speed changes in drawing the DrawLines ???
Thanks
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: CHart axis area Clipping
Hi Sandra,
Our previous TeeChart version we had installed was 4.0.2010.27960 Now we are up to 4.1.2010.11301
As well as the line studies the Line CandleStyles are also much slower ... which is a problem as under 4.0 the line CandleStyles where too slow .. but now under 4.1 they are no longer usable ... the Candle and Bar styles are still very fast.
I'm talking about switching between candleStyles i.e. CandleStyles.CandleStick; CandleStyles.CandleBar; CandleStyles.Line;
I have a button in the App that changes the CandleStyles between Bar, Candle, Line, Color Line and Point and Figure. It doesnt do anything too magical just reloades the data and draws with the new candleStyles .. works Fine between Candle and Bar ... Point and Figure I know has bugs and is waiting to be fixed at some point.
I do populate these Line and ColoredLine with the same OHLC data as Bar and Candle and generally I limit the amount of data to 10 years worth
I generally notice it when I try to zoom in to a Line Style chart and scroll .. it goes sooo slow .. the intial loading and drawing is fast enough .. zooming and scrolling on a candle or Bar chart is really fast.
For the time being I've reverted back to 4.0.2010.27960 (but I have copied across some of the bug fixes that I needed)
Our previous TeeChart version we had installed was 4.0.2010.27960 Now we are up to 4.1.2010.11301
As well as the line studies the Line CandleStyles are also much slower ... which is a problem as under 4.0 the line CandleStyles where too slow .. but now under 4.1 they are no longer usable ... the Candle and Bar styles are still very fast.
I'm talking about switching between candleStyles i.e. CandleStyles.CandleStick; CandleStyles.CandleBar; CandleStyles.Line;
I have a button in the App that changes the CandleStyles between Bar, Candle, Line, Color Line and Point and Figure. It doesnt do anything too magical just reloades the data and draws with the new candleStyles .. works Fine between Candle and Bar ... Point and Figure I know has bugs and is waiting to be fixed at some point.
I do populate these Line and ColoredLine with the same OHLC data as Bar and Candle and generally I limit the amount of data to 10 years worth
I generally notice it when I try to zoom in to a Line Style chart and scroll .. it goes sooo slow .. the intial loading and drawing is fast enough .. zooming and scrolling on a candle or Bar chart is really fast.
For the time being I've reverted back to 4.0.2010.27960 (but I have copied across some of the bug fixes that I needed)
--------------------
Cheers Phil.
Cheers Phil.