Legend Checkbox
Legend Checkbox
For my chart I needed legend checkbox to be in a pop floating window and not integrated with the chart as in the chart samples to avoid space used by it .
Is it doable?
Thanks,
Sachin
Is it doable?
Thanks,
Sachin
Re: Legend Checkbox
Hi Sachin,
Yes, for example you could use OnMouseClick event to show and hide the legend in combination with OnMouseMove event to retrieve the position to draw it:
Yes, for example you could use OnMouseClick event to show and hide the legend in combination with OnMouseMove event to retrieve the position to draw it:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
FastLine fast1, fast2, fast3;
int MouseX, MouseY;
private void InitializeChart()
{
chartController1.Chart = tChart1;
tChart1.Aspect.View3D = false;
tChart1.Legend.Visible = false;
fast1 = new FastLine(tChart1.Chart);
fast2 = new FastLine(tChart1.Chart);
fast3 = new FastLine(tChart1.Chart);
fast1.FillSampleValues(100);
fast2.FillSampleValues(100);
fast3.FillSampleValues(100);
tChart1.Legend.CheckBoxes = true;
tChart1.Click += new EventHandler(tChart1_Click);
tChart1.MouseMove += new MouseEventHandler(tChart1_MouseMove);
}
void tChart1_MouseMove(object sender, MouseEventArgs e)
{
MouseX = e.X;
MouseY = e.Y;
}
void tChart1_Click(object sender, EventArgs e)
{
if (tChart1.Legend.Clicked(MouseX, MouseY) == -1)
{
if (tChart1.Legend.Visible) tChart1.Legend.Visible = false;
else
{
tChart1.Legend.Visible = true;
tChart1.Legend.CustomPosition = true;
tChart1.Legend.Left = MouseX;
tChart1.Legend.Top = MouseY;
}
}
}
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Legend Checkbox
Hi Yeray ,
What I needed was chart will be on main panel & on click of a menu. A form pops up & the legend be the child to that popup form which user can move around or close whenever needed rather than appearing on the chart screen itself.
Thanks,
Sachin
What I needed was chart will be on main panel & on click of a menu. A form pops up & the legend be the child to that popup form which user can move around or close whenever needed rather than appearing on the chart screen itself.
Thanks,
Sachin
Re: Legend Checkbox
Hi Sachin,
Then I think that what you are looking for is the ChartListBox component. Take a look at the demo at All features\Welcome !\Components\Chart listbox. You'll find demos and tutorials at TeeChart programs group.
Then I think that what you are looking for is the ChartListBox component. Take a look at the demo at All features\Welcome !\Components\Chart listbox. You'll find demos and tutorials at TeeChart programs group.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Legend Checkbox
Thanks for the quick ply. This is exactly what I was looking for.
Thanks,
Sachin
Thanks,
Sachin
Axes labels questions
I have 2 questions about axes labels
1) Displaying Datetime labels on bottom axes when time range is in millisecs.
settings for axes
chart.Axes.Bottom.Labels.DateTimeFormat = "HH:mm:ss:fff";
chart.Axes.Bottom.Increment = (double)DateTimeSteps.OneMillisecond;
The datetime are not displayed in this scenario. It is displayed when time range is in secs or more. I am attaching the screenshots
2) second question. On Y axes I want to display axis labels at the points only on the series & not equal division of the axess. I tried doing this by handling getaxes label. As seen in the image this avoids displaying labels on axes but blank ticks are still visible.
Axis axes = chart.Axes.Custom[0];
if (sender.Equals(axes))
{
double tmp = Convert.ToDouble(e.LabelText);
for (int i = 0; i < chart.Series.Count; i++)
{
Series series = chart.Series;
if(series.YValues.IndexOf(tmp) != -1)
{
e.LabelText = tmp.ToString();
break;
}
else
{
double val = tmp;
e.LabelText = string.Empty;
}
}
Thanks,
Sachin
1) Displaying Datetime labels on bottom axes when time range is in millisecs.
settings for axes
chart.Axes.Bottom.Labels.DateTimeFormat = "HH:mm:ss:fff";
chart.Axes.Bottom.Increment = (double)DateTimeSteps.OneMillisecond;
The datetime are not displayed in this scenario. It is displayed when time range is in secs or more. I am attaching the screenshots
2) second question. On Y axes I want to display axis labels at the points only on the series & not equal division of the axess. I tried doing this by handling getaxes label. As seen in the image this avoids displaying labels on axes but blank ticks are still visible.
Axis axes = chart.Axes.Custom[0];
if (sender.Equals(axes))
{
double tmp = Convert.ToDouble(e.LabelText);
for (int i = 0; i < chart.Series.Count; i++)
{
Series series = chart.Series;
if(series.YValues.IndexOf(tmp) != -1)
{
e.LabelText = tmp.ToString();
break;
}
else
{
double val = tmp;
e.LabelText = string.Empty;
}
}
Thanks,
Sachin
Re: Legend Checkbox
Hello Sachin,
I hope that will helps.
Thanks,
When you want to increment values in axes with DatetimeFormat, you must use next lines of code, why works fine. Because this chart.Axes.Bottom.Increment = (double)DateTimeSteps.OneMillisecond, isn't correct.1) Displaying Datetime labels on bottom axes when time range is in millisecs.
Code: Select all
tChart1.Axes.Bottom.Labels.DateTimeFormat = "hh:mm:ss:ff";
tChart1.Axes.Bottom.Increment = Steema.TeeChart.Utils.GetDateTimeStep(Steema.TeeChart.DateTimeSteps.OneMillisecond);
If you want to hide Ticks, and minorTick, of your chart only you do next lines of code for your custom axes:2) second question. On Y axes I want to display axis labels at the points only on the series & not equal division of the axess. I tried doing this by handling getaxes label. As seen in the image this avoids displaying labels on axes but blank ticks are still visible.
Code: Select all
axes.Ticks.Visible = false;
axes.MinorTicks.Visible = false;
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: Legend Checkbox
2) second question. On Y axes I want to display axis labels at the points only on the series & not equal division of the axess. I tried doing this by handling getaxes label. As seen in the image this avoids displaying labels on axes but blank ticks are still visible.
If you want to hide Ticks, and minorTick, of your chart only you do next lines of code for your custom axes:
Basically what I was looking was, I needed axis to be labelled at all the YValues which corresponds to the series points and not equal division provide by TChart.
for eg. my series is drawn over ponts (10.0, 10.1, 10.5) Yvalues I needed this values to be labels on axes and not (10.0, 10.2, 10.4, 10.6) provided bu chart.
Thanks,
Sachin
If you want to hide Ticks, and minorTick, of your chart only you do next lines of code for your custom axes:
Basically what I was looking was, I needed axis to be labelled at all the YValues which corresponds to the series points and not equal division provide by TChart.
for eg. my series is drawn over ponts (10.0, 10.1, 10.5) Yvalues I needed this values to be labels on axes and not (10.0, 10.2, 10.4, 10.6) provided bu chart.
Thanks,
Sachin
Re: Legend Checkbox
Hello gs,
I hope will helps.
Thanks,
I'm sorry, I think that next is that if you want to do, please see next code and check that works with you want in your application.2) second question. On Y axes I want to display axis labels at the points only on the series & not equal division of the axess. I tried doing this by handling getaxes label. As seen in the image this avoids displaying labels on axes but blank ticks are still visible.
If you want to hide Ticks, and minorTick, of your chart only you do next lines of code for your custom axes:
Code: Select all
private Steema.TeeChart.Styles.Line line;
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
tChart1.Dock = DockStyle.Fill;
line = new Steema.TeeChart.Styles.Line(tChart1.Chart);
Random y = new Random();
for (int i = 0; i < 10; i++)
{
double val = y.Next(100);
line.Add(val, val.ToString());
}
line.XValues.DateTime = true;
//-----------------------DATE TIME----------------------------------------//
tChart1.Axes.Bottom.Labels.DateTimeFormat = "hh:mm:ss:ff";
tChart1.Axes.Bottom.Labels.Angle = 90;
tChart1.Axes.Bottom.Increment = Steema.TeeChart.Utils.GetDateTimeStep(Steema.TeeChart.DateTimeSteps.OneMillisecond);
//-------------------------CUSTOM AXES-------------------------------------//
Steema.TeeChart.Axis axes = new Steema.TeeChart.Axis(tChart1.Chart);
line.CustomVertAxis = axes;
tChart1.Axes.Custom.Add(axes);
axes.Labels.Style = Steema.TeeChart.AxisLabelStyle.Text;
tChart1.Panel.MarginLeft = 10;
axes.MinorTicks.Visible = false;
}
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 |