Page 1 of 1
Questions
Posted: Sun Aug 06, 2006 7:58 pm
by 9790349
Hi,
Q1.: I would like use the same Legend style with area style series as with line style series (a small line with LinePen.Color and a Pointer).
--[]-- line1
--[]-- area1 <--- that's what I want
--()-- line2
How can I do that?
Q2: When I set Pointer.Brush.Color there is no effect, the pointer always have a same color as a Line. How can I use a different Pointer color? (for example: a green line with red pointers)
Thanks in advance,
Gabor Varga
Posted: Mon Aug 07, 2006 7:35 pm
by 9790349
Hi,
Q3: I want to use MarkTips to show the Series name when the user move the cursor over the serie. I set the Chart Style of the Legend to Series Names and the MarkTips Style to Legend but it shows only the value of the Series.
What is the correct method to show what I want?
Q4: I have a DateTime Bottom axis and I set the following:
Code: Select all
with MyChart.Axes.Bottom do
begin
Labels.DateTimeFormat := 'yyyy.MM.dd HH:mm:ss';
Labels.MultiLine := true;
Labels.Separation := 0;
Labels.ExactDateTime := True;
Increment := Steema.TeeChart.Utils.GetDateTimeStep(Steema.TeeChart.DateTimeSteps.OneHour);
LabelsOnAxis := True;
Labels.RoundFirstLabel := False;
end;
But I see no effect when I set Separation, Increment, RoundFirstLabel...
How can I show Label on axis Minimum and Maximum, and how can I set axis Increment?
Thanks in advance,
Gabor Varga
Posted: Tue Aug 08, 2006 9:03 am
by Chris
Hello Gabor,
Q1.: I would like use the same Legend style with area style series as with line style series (a small line with LinePen.Color and a Pointer).
Try setting the pointer of the area series to true:
Q2: When I set Pointer.Brush.Color there is no effect, the pointer always have a same color as a Line. How can I use a different Pointer color? (for example: a green line with red pointers)
I've been able to reproduce this issue and have fixed it for the next maintenance release which is due to be released in early September.
Q3: I want to use MarkTips to show the Series name when the user move the cursor over the serie. I set the Chart Style of the Legend to Series Names and the MarkTips Style to Legend but it shows only the value of the Series.
Try using an annotation tool in conjunction with the mousemove event, e.g.
Code: Select all
private void tChart1_MouseMove(object sender, MouseEventArgs e)
{
int series1 = line1.Clicked(e.X, e.Y);
int series2 = line2.Clicked(e.X, e.Y);
int series3 = area1.Clicked(e.X, e.Y);
anno1.Shape.CustomPosition = true;
anno1.Left = e.X;
anno1.Top = e.Y;
if (series1 != -1)
{
anno1.Active = true;
anno1.Text = "Line1";
}
else if (series2 != -1)
{
anno1.Active = true;
anno1.Text = "Line2";
}
else if (series3 != -1)
{
anno1.Active = true;
anno1.Text = "Area1";
}
else
{
anno1.Active = false;
}
}
Q4: I have a DateTime Bottom axis and I set the following:
The increment works ok with the following code:
Code: Select all
private void InitializeChart()
{
line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
DateTime now = DateTime.Now;
Random rnd = new Random();
int length = 10;
for (int i = 0; i < length; i++)
{
now = now.AddMinutes(10);
line1.Add(now, rnd.NextDouble());
}
tChart1.Axes.Bottom.Labels.DateTimeFormat = "yyyy.MM.dd HH:mm:ss";
tChart1.Axes.Bottom.Labels.MultiLine = true;
tChart1.Axes.Bottom.Increment = ((1.0 / 24.0) / 60.0) * 20.0; //Steema.TeeChart.Utils.GetDateTimeStep(Steema.TeeChart.DateTimeSteps.FifteenMinutes);
}
Posted: Tue Aug 08, 2006 6:39 pm
by 9790349
Hello Christopher,
Thanks for you reply, I tried what you suggest but I have some comments:
Q1: OK, Pointer works fine, but the color of the line in Legend is not the Linepen.Color. (In our application all series are Lines, for us Area is a special Line which have filled area.)
Q4: Try to increment length variable from 10 to 1000. Bottom label Increment comes to daily, no label at minimum and maximum.
Best regards,
Gabor Varga
Posted: Wed Aug 09, 2006 10:58 am
by Chris
Hello,
Q1: OK, Pointer works fine, but the color of the line in Legend is not the Linepen.Color. (In our application all series are Lines, for us Area is a special Line which have filled area.)
I'm sorry, but I'm a little confused as to the code you could be using. Would you be so kind as to send me a little code snippet that I could run to see what you mean?
Q4: Try to increment length variable from 10 to 1000. Bottom label Increment comes to daily, no label at minimum and maximum.
Yes, this is because there are too many labels to be shown at the specified increment and therefore the chart automatically changes it.
Posted: Wed Aug 09, 2006 12:20 pm
by 9790349
Hi,
Q1: Add a Line and an Area to the TChart.
Set Border of the Area with the following properties:
Visible,
Style : Solid,
Color : Yellow
Width : 5
(In Editor: Series / Format / Border...)
In Legend you will see a the following:
----- line1 (a red line with "line1" caption)
[] area1 (a green rectangle with "area1" caption)
But I want to see the following
----- line1 (a red line with "line1" caption)
=== area1 (a 5 points width yellow line with caption "area1")
Q4: How can I force to show label at the Minimum and at the Maximum of the Axis? (And how can I force to show all Labels?)
Thanks,
Gabor Varga
Posted: Thu Aug 10, 2006 3:11 pm
by Chris
Hello,
Q1: Add a Line and an Area to the TChart.
OK. You could always try something like the following. Changing the shape of the Legend symbol is not going to be possible any other way at the moment.
Code: Select all
private void button1_Click(object sender, EventArgs e)
{
tChart1.Series.Add(new Steema.TeeChart.Styles.Line());
tChart1.Series.Add(new Steema.TeeChart.Styles.Area());
tChart1.Series.Add(new Steema.TeeChart.Styles.Line());
tChart1[1].ShowInLegend = false;
tChart1[2].Title = "area1";
tChart1[0].FillSampleValues();
tChart1[1].FillSampleValues();
(tChart1[2] as Line).LinePen.Width = 5;
for (int i = 0; i < tChart1[1].Count; ++i)
{
tChart1[2].Add(tChart1.Series[1].XValues[i], tChart1.Series[1].YValues[i]);
}
}
Q4: How can I force to show label at the Minimum and at the Maximum of the Axis? (And how can I force to show all Labels?)
Setting the separation to zero will force all labels to draw if tchart thinks it can draw them all, however, it will not draw them all if it considers that doing so would produce an unreadable chart.
As for choosing which labels to display, you might want to have a look at the tutorials and specifically the tutorials on axes where it talks about the GetNextAxisLabel event.
Posted: Thu Aug 10, 2006 4:13 pm
by Chris
Hello,
As for choosing which labels to display, you might want to have a look at the tutorials and specifically the tutorials on axes where it talks about the GetNextAxisLabel event.
A quick and dirty way of doing this would be to add in your datatime values as labels, e.g.
Code: Select all
private void InitializeChart()
{
int length = 10;
DateTime now = DateTime.Now;
Random rnd = new Random();
tChart1.Axes.Bottom.Labels.DateTimeFormat = "hh:mm";
for (int i = 0; i < length; i++)
{
line1.Add(now, rnd.NextDouble(), now.ToString(tChart1.Axes.Bottom.Labels.DateTimeFormat));
now = now.AddHours(1);
}
}
Posted: Sun Aug 13, 2006 5:27 pm
by 9790349
Hi,
Q1: OK, but I would like to have an event when user make invisible the tchart[ 2 ] serie with checking out the checkbox in the Legend to make tchart[ 1 ] invisible from code.
Best regards,
Gabor Varga
Posted: Mon Aug 14, 2006 10:07 am
by Chris
Hello,
Sure, you can use:
Code: Select all
private void tChart1_ClickLegend(object sender, MouseEventArgs e)
{
line2.Active = line1.Active;
}