ColorGrid-code continuous selection of cells in C# .Net v3
ColorGrid-code continuous selection of cells in C# .Net v3
Dear Support,
I have posted the below underlined question and received the response from you yesterday, Since I am using the TeeChart for .NET v3 version please send the mention code in the reply in c#. As you mentioned in your reply placing different icons for different cells is not supported please send the code to implement continuous selection of cells in c#.
Appreciate faster response as this feature is critical for our tool.
I want to select few cells in the color grid by mouse drag option is that possible. Continuous selection is supported in color grid.
Is that possible to add different images in different cells of color grid.
Thanks,
Muthu,
Jubilant Biosys.
Hi Muthu,
Quote:
I want to select few cells in the color grid by mouse drag option is that possible. Continuous selection is supported in color grid.
Yes, you can do something as what I suggested here.
Quote:
Is that possible to add different images in different cells of color grid.
You can use an image for the entire series, something as in the All Features\Welcome !\Chart styles\Statistical\Color Grid\ColorGrid Bitmap example in the features demo. However, it's not possible to use an image for each cell. If you let us know the TeeChart version you are using I'll add your request to the wish-list to be considered for inclusion in future releases.
Also we'd appreciate if you posted your technical inquiries at specific forum for the TeeChart version you are using. This way it would be easier for us to provide more accurate replies.
Thanks in advance.
_________________
Best Regards
Narcís Calvet
Steema Support Central
I have posted the below underlined question and received the response from you yesterday, Since I am using the TeeChart for .NET v3 version please send the mention code in the reply in c#. As you mentioned in your reply placing different icons for different cells is not supported please send the code to implement continuous selection of cells in c#.
Appreciate faster response as this feature is critical for our tool.
I want to select few cells in the color grid by mouse drag option is that possible. Continuous selection is supported in color grid.
Is that possible to add different images in different cells of color grid.
Thanks,
Muthu,
Jubilant Biosys.
Hi Muthu,
Quote:
I want to select few cells in the color grid by mouse drag option is that possible. Continuous selection is supported in color grid.
Yes, you can do something as what I suggested here.
Quote:
Is that possible to add different images in different cells of color grid.
You can use an image for the entire series, something as in the All Features\Welcome !\Chart styles\Statistical\Color Grid\ColorGrid Bitmap example in the features demo. However, it's not possible to use an image for each cell. If you let us know the TeeChart version you are using I'll add your request to the wish-list to be considered for inclusion in future releases.
Also we'd appreciate if you posted your technical inquiries at specific forum for the TeeChart version you are using. This way it would be easier for us to provide more accurate replies.
Thanks in advance.
_________________
Best Regards
Narcís Calvet
Steema Support Central
Hi Muthu,
Here there is the c# version of the code that Narcis pointed to you yesterday:
I hope this helps.
EDIT: Code revised correcting errors found in later posts in this thread.
Here there is the c# version of the code that Narcis pointed to you yesterday:
Code: Select all
public partial class Form1 : Form
{
int X0, X1, Y0, Y1, XIndex, YIndex;
Boolean DrawRect;
public Form1()
{
InitializeComponent();
}
private Steema.TeeChart.Styles.ColorGrid colorGrid1;
private void Form1_Load(object sender, EventArgs e)
{
colorGrid1 = new Steema.TeeChart.Styles.ColorGrid(tChart1.Chart);
colorGrid1.FillSampleValues(10);
tChart1.Zoom.Allow = false;
tChart1.Aspect.View3D = false;
}
private void tChart1_MouseDown(object sender, MouseEventArgs e)
{
listBox1.Items.Clear();
X0 = e.X;
Y0 = e.Y;
XIndex = colorGrid1.Clicked(new Point(e.X,e.Y));
DrawRect = true;
}
private void tChart1_MouseMove(object sender, MouseEventArgs e)
{
if (DrawRect)
{
X1 = e.X;
Y1 = e.Y;
tChart1.Refresh();
}
}
private void tChart1_MouseUp(object sender, MouseEventArgs e)
{
DrawRect = false;
YIndex = colorGrid1.Clicked(X1,Y1);
GetRectIndexes();
tChart1.Refresh();
}
private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
g.Pen.Color = Color.White;
g.Pen.Width = 2;
g.Brush.Visible = false;
g.Rectangle(X0, Y0, X1, Y1);
}
private void GetRectIndexes()
{
int Col0, Row0, Col1, Row1;
Col0 = GetColumn(XIndex);
Row0 = GetRow(XIndex);
Col1 = GetColumn(YIndex);
Row1 = GetRow(YIndex);
for (int x = Math.Min(Col0, Col1); x < Math.Max(Col0, Col1); x++)
for (int z = Math.Min(Row0, Row1); z < Math.Max(Row0, Row1); z++)
listBox1.Items.Add(colorGrid1.YValues[(x * colorGrid1.NumXValues) + z]);
}
private int GetColumn(int ValueIndex)
{
return ValueIndex / (colorGrid1.NumXValues - 1);
}
private int GetRow(int ValueIndex)
{
return ValueIndex % (colorGrid1.NumZValues - 1);
}
}
EDIT: Code revised correcting errors found in later posts in this thread.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Need multi point selection option in Points series
Dear Yeray,
Multi-cell selection in Colorgrid is working fine.
Now i need to implement the same future in Points series also.
When i tried to convert the same code what i got for Colorgrid, i am facing some problem.
The following code always return -1 .
tChart1.Series[0].Clicked(new Point(e.X, e.Y));// PointsForSP[0].Clicked(X1, Y1);
It will help me, if you give any sample code/ application for multi point selection future in Points series.
With regards,
Muthu.
Multi-cell selection in Colorgrid is working fine.
Now i need to implement the same future in Points series also.
When i tried to convert the same code what i got for Colorgrid, i am facing some problem.
The following code always return -1 .
tChart1.Series[0].Clicked(new Point(e.X, e.Y));// PointsForSP[0].Clicked(X1, Y1);
It will help me, if you give any sample code/ application for multi point selection future in Points series.
With regards,
Muthu.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Muthu,
You could do the same as the examples discussed on this thread:
http://www.teechart.net/support/viewtopic.php?t=5385
You could do the same as the examples discussed on this thread:
http://www.teechart.net/support/viewtopic.php?t=5385
Best Regards,
Narcís Calvet / 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 |
Need multi point selection option in Points series
Dear Nacis,
It is working fine.
Thank you.
It is working fine.
Thank you.
Re:
Hi Yeray,Yeray wrote:Code: Select all
private int GetColumn(int ValueIndex) { return ValueIndex / colorGrid1.NumXValues; } private int GetRow(int ValueIndex) { return ValueIndex % colorGrid1.NumZValues; }
Could you please explain how does GetRow method work? Why there are no NumYValues?
I have tried to get Col and Row in the same way and get following values:
I would expect 0.0, 1.1, 2.2, 3.3 etc. as a diagonal cells. Could you suggest how can I do this?
Thanks.
Re: Re:
Hello,
First of all, after revising the code above I've done a small change at GetRectIndexes method to make it a bit more elegant: change this:;
for this:
NumXValues is the number of values/cells at each row.
NumZValues is the number of values/cells at each column.
NumYValues has little sense because YValues is used to represent the color of the values, not to represent rows/columns. If you want to know the total number of cells you can use the series' Count property.
I've tried this code:
gives me this:
c0 r0 ... c0 r9
c1 r0 ... c1 r9
...
c9 r0 ... c9 r9
Of course this is the result when populating the ColorGrid with FillSampleValues(10), that internally adds 10x10 values.
First of all, after revising the code above I've done a small change at GetRectIndexes method to make it a bit more elegant: change this:;
Code: Select all
listBox1.Items.Add(colorGrid1.YValues[(x * 10) + z]);
Code: Select all
listBox1.Items.Add(colorGrid1.YValues[(x * colorGrid1.NumXValues) + z]);
GetRow returns the Index of the Row for the given ValueIndex.icecream wrote:Could you please explain how does GetRow method work? Why there are no NumYValues?
NumXValues is the number of values/cells at each row.
NumZValues is the number of values/cells at each column.
NumYValues has little sense because YValues is used to represent the color of the values, not to represent rows/columns. If you want to know the total number of cells you can use the series' Count property.
How are you drawing that table?icecream wrote:I have tried to get Col and Row in the same way and get following values:
I would expect 0.0, 1.1, 2.2, 3.3 etc. as a diagonal cells. Could you suggest how can I do this?
I've tried this code:
Code: Select all
for (int i = 0; i < colorGrid1.Count; i++)
listBox1.Items.Add("c" + GetColumn(i) + " r" + GetRow(i));
c0 r0 ... c0 r9
c1 r0 ... c1 r9
...
c9 r0 ... c9 r9
Of course this is the result when populating the ColorGrid with FillSampleValues(10), that internally adds 10x10 values.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Re:
This is a code that creates color grid:Yeray wrote: How are you drawing that table?
Code: Select all
for (int r = 1; r <= rCount; r++)
for (int c = 1; c <= cCount; c++)
{
colorGrid1.Add(c, 0, r);
}
Code: Select all
private Point GetCellIndexes()
{
return new Point(GetColumn(m_index), GetRow(m_index));
}
private int GetColumn(int ValueIndex)
{
return ValueIndex / m_heatMapSeries.NumXValues;
}
private int GetRow(int ValueIndex)
{
return ValueIndex % m_heatMapSeries.NumZValues;
}
private void m_chart_MouseClick(object sender, MouseEventArgs e)
{
m_index = colorGrid1.Clicked(new Point(e.X, e.Y));
Point p = GetCellIndexes();
}
Re: ColorGrid-code continuous selection of cells in C# .Net v3
Hello,
Using the following test code:
I get this:
c0 r0 ... c0 r9
c1 r0 ... c1 r9
...
c6 r0 ... c6 r9
c7 r0 c7 r1
That is obviously wrong. But changing the GetColumn&GetRow functions for the following:
the same example now gives this:
c0 r0 ... c0 r8
c1 r0 ... c1 r8
...
c7 r0 ... c7 r8
that is now correct.
This helped me to find a mistake in GetColumn&GetRow functions.icecream wrote:Yeray wrote: How are you drawing that table?Code: Select all
for (int r = 1; r <= rCount; r++) for (int c = 1; c <= cCount; c++) { colorGrid1.Add(c, 0, r); }
Using the following test code:
Code: Select all
colorGrid1 = new ColorGrid(tChart1.Chart);
int rCount = 9;
int cCount = 8;
for (int r = 1; r <= rCount; r++)
for (int c = 1; c <= cCount; c++)
{
colorGrid1.Add(c, 0, r);
}
tChart1.Zoom.Direction = ZoomDirections.None;
tChart1.Aspect.View3D = false;
for (int i = 0; i < colorGrid1.Count; i++)
listBox1.Items.Add("c" + GetColumn(i) + " r" + GetRow(i));
c0 r0 ... c0 r9
c1 r0 ... c1 r9
...
c6 r0 ... c6 r9
c7 r0 c7 r1
That is obviously wrong. But changing the GetColumn&GetRow functions for the following:
Code: Select all
private int GetColumn(int ValueIndex)
{
return ValueIndex / (colorGrid1.NumXValues - 1);
}
private int GetRow(int ValueIndex)
{
return ValueIndex % (colorGrid1.NumZValues - 1);
}
c0 r0 ... c0 r8
c1 r0 ... c1 r8
...
c7 r0 ... c7 r8
that is now correct.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |