Page 1 of 1
ColorLine and Move chart
Posted: Tue Nov 12, 2013 2:01 pm
by 15654539
Please find this example
http://193.145.251.126/pnp/files/ZQyAYs ... chart3.zip
Button1 adds a colorline in 150, if you move then the chart the color line goes out of the chart (in the screen shot you can see it below the x axis).
I see it only happnes if AllowDrop property is false
Is it a bug or can I avoid going out the chart?
Thanks
Re: ColorLine and Move chart
Posted: Thu Nov 14, 2013 2:12 pm
by 10050769
Hello wakeup,
To solve your problem I recommend you taking a look in this
link, where you find different methods to avoid ColorLine tool drag out of bounds of chart.
I hope will helps.
Thanks,
Re: ColorLine and Move chart
Posted: Thu Nov 14, 2013 3:34 pm
by 15654539
The first solution is not valid because I dont want it to be dragable.
And the second doesn't run well, sometime the tool is active and it is not shown, and somtimes it is not active and it is shown. It seems it is not well refreshed the active property.
Is this issue already reported as a bug?
Thanks
Re: ColorLine and Move chart
Posted: Fri Nov 15, 2013 2:25 pm
by 10050769
Hello wakeup,
I have modified the code and now it works in correct way:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
FastLine fastLine1 = new FastLine(tChart1.Chart);
var line = new ColorLine(tChart1.Chart)
{
Axis = tChart1.Axes.Left,
Pen = { Style = DashStyle.Solid, Color = Color.Red, Width = 1 },
AllowDrag = false
};
tChart1.Aspect.View3D = false;
tChart1.Header.Font.Bold = true;
tChart1.Header.Font.Size = 15;
fastLine1.FillSampleValues();
line.Value = fastLine1.YValues.Minimum - 50;
fastLine1.LinePen.Width = 1;
tChart1.AfterDraw += tChart1_AfterDraw;
tChart1.Draw();
}
void tChart1_AfterDraw(object sender, Graphics3D g)
{
for (int i = 0; i < tChart1.Tools.Count; i++)
{
Steema.TeeChart.Tools.Tool tool = tChart1.Tools[i];
if (tool is Steema.TeeChart.Tools.ColorLine)
{
if ((tool as Steema.TeeChart.Tools.ColorLine).Value < tChart1.Axes.Left.Minimum || (tool as Steema.TeeChart.Tools.ColorLine).Value > tChart1.Axes.Left.Maximum)
{
tool.Active = false;
}
else
{
tool.Active = true;
}
}
}
}
Could you tell us if previous code works in your end?
Thanks,
Re: ColorLine and Move chart
Posted: Fri Nov 15, 2013 2:40 pm
by 15654539
I did change bottom to left axis in the previous code. That is not the reason because it didn't run. The reason was sometime the tool is active and it is not shown, and sometimes it is not active and it is shown. It seems it is not well refreshed the active property. It sometimes happens in general in teechart, but I use to solve it putting a chart.refresh() in the code, but in this case I can't because it would be a infinite loop.
Is this issue already reported as a bug?
Re: ColorLine and Move chart
Posted: Fri Nov 15, 2013 3:29 pm
by 10050769
Hello wakeup,
The line of code I have added to solve the problem is next:
Code: Select all
tChart1.AfterDraw += tChart1_AfterDraw;
tChart1.Draw();
I realized is necessary repainting the chart after initialize AfterDraw event, so the ColorLine tool is drawing correctly and if I use tChart1.Draw() method, the active property is refreshed as I expect. Please, check my code and tell us if it help you.
Thanks,
Re: ColorLine and Move chart
Posted: Fri Nov 15, 2013 3:58 pm
by 15654539
I follow with the same problems with that code:
I already had the instrucction
this.chart.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(this.chart_AfterDraw);
which I think is similar.
and "chart.Draw();" in the initialization doesn't do anything especial, because the refreshing problem is not in the initialization, but in the "AfterDraw" function, and in that function I cannot put the chart.Draw() instruction because it would be a infinite loop.
Re: ColorLine and Move chart
Posted: Fri Nov 15, 2013 4:26 pm
by 10050769
Hello wakeup,
Ok. I couldn't reproduce the problem you there is with ColorLine Tool using my last code. Could you please, make a project, where your problem appears and I can reproduce it here?
Thanks,
Re: ColorLine and Move chart
Posted: Mon Nov 18, 2013 9:10 am
by 15654539
Here you have
http://193.145.251.126/pnp/files/QOQduc ... orline.zip
If you do zoom, and after that an uzoom, most of the times the color line is not shown.
Thanks
Re: ColorLine and Move chart
Posted: Mon Nov 18, 2013 1:03 pm
by 10050769
Hello wakeup,
Your code need refresh the chart when you add data and do Unzoom, if you want ColorLine draw correctly. I have modified your code and it works in my end:
Code: Select all
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
tChart1.UndoneZoom += tChart1_UndoneZoom;
}
void tChart1_UndoneZoom(object sender, EventArgs e)
{
tChart1.Draw();
}
private void button1_Click(object sender, EventArgs e)
{
tChart1.Series[0].FillSampleValues();
tChart1.Draw();
}
private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
for (int i = 0; i < tChart1.Tools.Count; i++)
{
Steema.TeeChart.Tools.Tool tool = tChart1.Tools[i];
if (tool is Steema.TeeChart.Tools.ColorLine)
{
if ((tool as Steema.TeeChart.Tools.ColorLine).Value < tChart1.Axes.Left.Minimum || (tool as Steema.TeeChart.Tools.ColorLine).Value > tChart1.Axes.Left.Maximum)
{
tool.Active = false;
}
else
{
tool.Active = true;
}
}
}
}
Could you confirm us if the code works now in your end?
Thanks.
Re: ColorLine and Move chart
Posted: Mon Nov 18, 2013 1:54 pm
by 15654539
Ok thanks, now it seems to run. But anyway, I think it would be better to do all this automatically, as when allowDrop is true. Would not it?
Re: ColorLine and Move chart
Posted: Thu Nov 21, 2013 9:13 am
by 10050769
Hello wakeup,
Sorry for the delay. After do many test with ColorLine tool we consider your request as a bug and we have added it to bug list with number [id447]. We will try to fix it to upcoming versions of TeeChartFor.Net. Remember you can follow its status in this
link. On the other hand, if you want you can sign up at
bugzilla and submit and follow up issues yourself in our
new bugzilla bug tracking system
Thanks,