TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
-
Christopher
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Post
by Christopher » Fri Mar 07, 2014 1:48 pm
wakeup wrote:What I'm asking is how is the right way to update the data of a serie in that case. Itried with the code in the button4 but it creates a lot of new series in the subchart.
I see. Try:
Code: Select all
void tChart1_BeforeDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
if (tChart1.Series[0].CustomVertAxis != null)
{
double maxVal = tChart1.Series[0].YValues.Maximum;
float width = tChart1.Graphics3D.TextWidth(maxVal.ToString(tChart1.Series[0].CustomVertAxis.Labels.ValueFormat));
Rectangle rect = tChart1.Chart.ChartRect;
rect.X = Steema.TeeChart.Utils.Round((width * 1) + 30);
rect.Width = tChart1.Width - 80;
tChart1.Chart.ChartRect = rect;
width *= 1.3f;
mt.SubChartTChart.Chart.CustomChartRect = true;
rect.X -= Steema.TeeChart.Utils.Round(width);
rect.Width += Steema.TeeChart.Utils.Round(width);
mt.SubChartTChart.Chart.ChartRect = rect;
}
}
private void button4_Click(object sender, EventArgs e)
{
Steema.TeeChart.Axis axis = tChart1.Series[0].CustomVertAxis;
tChart1.Series[0].CustomVertAxis = null;
tChart1.Series[0].VertAxis = Steema.TeeChart.Styles.VerticalAxis.Left;
tChart1.Series[0].FillSampleValues();
mt.SubChartTChart.Clear();
mt.Series = tChart1.Series[0];
tChart1.Series[0].CustomVertAxis = axis;
}
-
acastro
- Advanced
- Posts: 204
- Joined: Tue Oct 27, 2009 12:00 am
Post
by acastro » Mon Mar 10, 2014 5:16 pm
Thanks it runs.
Only left a small detail, is it possible to set to the subchart of the scroll pager the same margin than the main chart?
Thanks
-
Attachments
-
- scrollmultiaxis.png (30.77 KiB) Viewed 22449 times
-
Christopher
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Post
by Christopher » Tue Mar 11, 2014 3:19 pm
wakeup wrote:Only left a small detail, is it possible to set to the subchart of the scroll pager the same margin than the main chart?
Can't you use a technique similar to the one I mentioned
here?
-
acastro
- Advanced
- Posts: 204
- Joined: Tue Oct 27, 2009 12:00 am
Post
by acastro » Wed Mar 12, 2014 9:46 am
I have just tried I put:
Code: Select all
((ScrollPager)chart.Tools[i]).SubChartTChart.Chart.CustomChartRect = true;
((ScrollPager)chart.Tools[i]).SubChartTChart.Chart.ChartRect = rect;
It runs, I put the same "rect" as the main chart, but the margin is not exactly the same:
-
Attachments
-
- margin.png (110.21 KiB) Viewed 22445 times
-
Christopher
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Post
by Christopher » Wed Mar 12, 2014 9:58 am
wakeup wrote:It runs, I put the same "rect" as the main chart, but the margin is not exactly the same:
That's why in the code in
this post there is the line:
-
acastro
- Advanced
- Posts: 204
- Joined: Tue Oct 27, 2009 12:00 am
Post
by acastro » Wed Mar 12, 2014 10:20 am
In my code I don't have that line, in fact in assign exactly the same rect to the chart and the subchart...
-
Christopher
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Post
by Christopher » Wed Mar 12, 2014 10:38 am
wakeup wrote:In my code I don't have that line, in fact in assign exactly the same rect to the chart and the subchart...
That's right.
If you want the two Charts to align, then that line (or similar) is necessary.
-
acastro
- Advanced
- Posts: 204
- Joined: Tue Oct 27, 2009 12:00 am
Post
by acastro » Wed Mar 12, 2014 11:03 am
I tried also with that line and they don't align neither...
-
Christopher
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Post
by Christopher » Wed Mar 12, 2014 11:57 am
wakeup wrote:I tried also with that line and they don't align neither...
Can you please provide a code sample for me please, along the lines of the SIMPLE EXAMPLE PROJECT described in point two
here?
-
Christopher
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Post
by Christopher » Thu Mar 13, 2014 12:18 pm
wakeup wrote:Please press buttons1, 2 and 4
The way to do this would be with code such as the following:
Code: Select all
void SubChartTChart_GetAxesChartRect(object sender, Steema.TeeChart.GetAxesChartRectEventArgs e)
{
if (tChart1.Series[0].CustomVertAxis != null)
{
Rectangle chartRect = tChart1.Chart.ChartRect;
Rectangle rect = e.AxesChartRect;
rect.X = chartRect.X;
rect.Width = chartRect.Width;
e.AxesChartRect = rect;
}
}
private void button1_Click(object sender, EventArgs e)
{
mt = new Steema.TeeChart.Tools.ScrollPager(tChart1.Chart);
for (int i = 0; i < tChart1.Series.Count; i++)
{
if (tChart1.Series[i].Count > 0)
mt.Series = tChart1.Series[i];
}
mt.SubChartTChart.GetAxesChartRect += SubChartTChart_GetAxesChartRect;
}
void tChart1_BeforeDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
double maxVal = tChart1.Series[0].YValues.Maximum;
float twidth = tChart1.Graphics3D.TextWidth(maxVal.ToString(tChart1.Series[0].CustomVertAxis.Labels.ValueFormat));
int width = Steema.TeeChart.Utils.Round(twidth) + 30;
Rectangle rect = tChart1.Chart.ChartRect;
rect.X = width;
rect.Width = tChart1.Width - 80;
tChart1.Chart.ChartRect = rect;
mt.SubChartTChart.Legend.Visible = false;
}
However, because of defect
id=632 (now fixed), you can see that the axis labels aren't lined up correctly.
-
acastro
- Advanced
- Posts: 204
- Joined: Tue Oct 27, 2009 12:00 am
Post
by acastro » Thu Mar 13, 2014 12:28 pm
Ok, I will wait to have the bug solved to try it.
thanks
-
Christopher
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Post
by Christopher » Thu May 22, 2014 9:59 am
Which defect do you think has not been fixed?
Looking through this thread I see that
id=632 is, in fact, fixed in the latest version. Try running the code in that bug report to see for yourself.
-
acastro
- Advanced
- Posts: 204
- Joined: Tue Oct 27, 2009 12:00 am
Post
by acastro » Thu May 22, 2014 10:09 am
Tchart still is having problmes to set well the margin with scrollpager and custom axis. You can reproduce it with the example I sent in the previous post.
-
Attachments
-
- margin.png (35.94 KiB) Viewed 22283 times