TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
-
Nik
- Newbie
- Posts: 9
- Joined: Wed Mar 07, 2012 12:00 am
Post
by Nik » Mon Nov 26, 2012 8:53 am
Hi
How can resize some points in serie ?
Example
Code: Select all
DataSet ds = new DataSet();
DataTable dt = new DataTable();
dt.TableName = "myTable";
dt.Columns.Add(new DataColumn("X", System.Type.GetType("System.Double")));
dt.Columns.Add(new DataColumn("Y", System.Type.GetType("System.Double")));
dt.Rows.Add(new Object[] { 1, 1 });
dt.Rows.Add(new Object[] { 2, 2 });
dt.Rows.Add(new Object[] { 3, 3 });
dt.Rows.Add(new Object[] { 4, 4 });
ds.Tables.Add(dt);
Steema.TeeChart.Styles.Points _seriesPoints = new Steema.TeeChart.Styles.Points();
_seriesPoints.Pointer.VertSize = 2;
_seriesPoints.Pointer.HorizSize = 2;
_seriesPoints.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Rectangle;
_seriesPoints.DataSource = ds.Tables["myTable"];
_seriesPoints.XValues.DataMember = "X";
_seriesPoints.YValues.DataMember = "Y";
_seriesPoints.Visible = true;
tChart1.Series.Add(_seriesPoints);
Random _rnd = new Random();
for (int i = 0; i < 40; i++) {
ds.Tables["myTable"].Rows[i % 4]["Y"] = _rnd.Next(5);
_seriesPoints.CheckDataSource();
// I think, this must be code or call event changing vert and horiz size rectangle of (i % 4) point
System.Threading.Thread.Sleep(500);
}
I want set _seriesPoints.Pointer.VertSize and _seriesPoints.Pointer.HorizSize equal new value in field "Y" for the point.
(on start all points must have different vert and horiz size rectangle)
How can do it ?
-
Sandra
- Site Admin
- Posts: 3132
- Joined: Fri Nov 07, 2008 12:00 am
Post
by Sandra » Tue Nov 27, 2012 10:15 am
Hello Nik,
I have made a simple code where I am resized the pointer of point series automatically and I think you can do something as next:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
// InitializeButton();
}
Steema.TeeChart.Styles.Points Series1;
Timer timer1;
private void InitializeChart()
{ //Timer
timer1 = new Timer();
timer1.Tick += new EventHandler(timer1_Tick);
//Chart
tChart1.Aspect.View3D = false;
//Series
Series1 = new Points(tChart1.Chart);
Series1.DataSource = GetDataSet();
Series1.XValues.DataMember = "X";
Series1.YValues.DataMember = "Y";
//InitializeSize
Series1.Pointer.VertSize = 2;
Series1.Pointer.HorizSize = 2;
timer1.Start();
timer1.Interval = 500;
tChart1.AfterDraw += new PaintChartEventHandler(tChart1_AfterDraw);
}
void tChart1_AfterDraw(object sender, Graphics3D g)
{
Series1.Pointer.HorizSize = (int)Series1.XValues.Maximum;
Series1.Pointer.VertSize = (int)Series1.YValues.Maximum;
}
void timer1_Tick(object sender, EventArgs e)
{
Random rnd = new Random();
DataTable dt = GetDataSet().Tables["DataTable"];
for (int i = 0; i < 40; i++)
{
dt.Rows[i % 4]["Y"] = rnd.Next(5);
}
Series1.DataSource = dt;
Series1.CheckDataSource();
}
private DataSet GetDataSet()
{
DataSet TeeDataSet = new DataSet();
DataTable TeeDataTable = new DataTable("DataTable");
DataColumn xval = new DataColumn("X", typeof(double));
DataColumn yval = new DataColumn("Y", typeof(double));
TeeDataTable.Columns.Add(xval);
TeeDataTable.Columns.Add(yval);
TeeDataTable.Rows.Add(new Object[] { 1, 1 });
TeeDataTable.Rows.Add(new Object[] { 2, 2 });
TeeDataTable.Rows.Add(new Object[] { 3, 3 });
TeeDataTable.Rows.Add(new Object[] { 4, 4 });
TeeDataSet.Tables.Add(TeeDataTable);
return TeeDataSet;
}
Could you tell us if previous code help you?
I hope will helps.
Thanks,
-
Nik
- Newbie
- Posts: 9
- Joined: Wed Mar 07, 2012 12:00 am
Post
by Nik » Wed Nov 28, 2012 8:34 am
Y understand not correct.
I don't want make size all points in serie equal.
Need each point in serie set size equal her yval.
Example
1 point have yval == 3 then size must = 3
2 point have yval == 2 then size must = 2
3 point have yval == 5 then size must = 5
How can do it?
-
Sandra
- Site Admin
- Posts: 3132
- Joined: Fri Nov 07, 2008 12:00 am
Post
by Sandra » Wed Nov 28, 2012 11:02 am
Hello Nick,
I am afraid as you want, is not possible at the moment. I have added your request in wish-list[TF02016437] to be consider its inclusion in upcoming versions of TeeChartFor.Net.
Thanks,
-
Nik
- Newbie
- Posts: 9
- Joined: Wed Mar 07, 2012 12:00 am
Post
by Nik » Wed Nov 28, 2012 12:46 pm
Why afraid ?
If Steema can have different color for each point,
what strange have different size for each point?
-
Sandra
- Site Admin
- Posts: 3132
- Joined: Fri Nov 07, 2008 12:00 am
Post
by Sandra » Thu Nov 29, 2012 9:29 am
Hello Nik,
You can not change directly in the pointers size for each point, as you do with color. We must implement a property that allow do it, because at the moment, size property is treated jointly for all pointers. For this reason, we have added request in bug list report with number [TF02016437] to be consider its inclusion to future versions. I recommend you to be aware at this forum, our
RSS news feed,
twitter and
facebook accounts for new release announcements and what's implemented on them.
Thanks,
-
Sandra
- Site Admin
- Posts: 3132
- Joined: Fri Nov 07, 2008 12:00 am
Post
by Sandra » Fri Feb 22, 2013 10:13 am
Hello Nik,
I inform you we have closed the bug number TF02016437 as not a bug, because is possible achieve change HorizSize and VertSize using next code:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
Points point = new Points(tChart1.Chart);
point.FillSampleValues();
point.GetPointerStyle += point_GetPointerStyle;
}
void point_GetPointerStyle(CustomPoint series, GetPointerStyleEventArgs e)
{
if (e.ValueIndex == 3)
{
series.Pointer.HorizSize = 10;
series.Pointer.VertSize = 10;
e.Color = Color.Red;
}
else
{
series.Pointer.HorizSize = 4;
}
}
Sorry for the inconveniences.
Thanks,