Problem with SurfaceNearest Tool

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
messsysteme
Newbie
Newbie
Posts: 4
Joined: Tue Mar 18, 2025 12:00 am

Problem with SurfaceNearest Tool

Post by messsysteme » Tue Aug 12, 2025 8:48 am

Using Teechart 2025.7.7 with 3D surface, I have a problem with surfaceNearestTool.
After Redraw, all cells are displayed in rainbow colors.
If I move the cursor on the cells, all colors disappear and all cells have same color.
This problem changes with Z range.
My setup is here:
surface1.PaletteMin = 0;
surface1.PaletteStep = 100;
surface1.PaletteStyle = Steema.TeeChart.Styles.PaletteStyles.Rainbow;
surface1.Title = "surface1";
surface1.UseColorRange = false;
surface1.UsePalette = true;
surface1.PaletteSteps = 30;
surfaceNearestTool1.Series = surface1;
Best Regards
Christian Frank
Attachments
teechart_3D_before_cursor_nearesttool_contact.jpg
teechart_3D_before_cursor_nearesttool_contact.jpg (148.85 KiB) Viewed 165 times
teechart_3D_after_cursor_nearesttool_contact.jpg
teechart_3D_after_cursor_nearesttool_contact.jpg (127.08 KiB) Viewed 165 times

Marc
Site Admin
Site Admin
Posts: 1338
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: Problem with SurfaceNearest Tool

Post by Marc » Tue Aug 12, 2025 10:45 am

Hello Christian,

Check that you have no event running that's resetting UsePalette.

This code test ok and may be worth checking as a comparison:

Code: Select all

tChart1.Aspect.View3D = true;
tChart1.Aspect.Chart3DPercent = 40;

tChart1.Series.Clear();
tChart1.Tools.Clear();

surface1 = new Steema.TeeChart.Styles.Surface();
surfaceNearestTool1 = new Steema.TeeChart.Tools.SurfaceNearestTool();
tChart1.Series.Add(surface1);
tChart1.Tools.Add(surfaceNearestTool1);

surface1.UseColorRange = false;
surface1.UsePalette = true;
surface1.PaletteMin = 0D;
surface1.PaletteStep = 0D;
surface1.PaletteStyle = Steema.TeeChart.Styles.PaletteStyles.Rainbow;
surface1.Title = "surface1";
surface1.FillSampleValues(50);

surfaceNearestTool1.CellColor = System.Drawing.Color.Red;
surfaceNearestTool1.ColumnColor = System.Drawing.Color.Green;
surfaceNearestTool1.RowColor = System.Drawing.Color.Blue;
surfaceNearestTool1.SelectedCell = -1;
surfaceNearestTool1.Series = surface1;
surfaceNearestTool1.SeriesIndex = 0;
I've checked this on framework 4.8. Let me know if you're running a later framework and the test code shows the same problem.

Regards,
Marc Meumann
Steema Support

messsysteme
Newbie
Newbie
Posts: 4
Joined: Tue Mar 18, 2025 12:00 am

Re: Problem with SurfaceNearest Tool

Post by messsysteme » Tue Aug 12, 2025 1:00 pm

Hello Mark,

thank you for your sample code.
I work with Visual Studio 2022 and have framework 4.8.
I have tested with your code, all works fine with sample values or with some demo values.
But when I draw my user data, then I habe the same problem, all colors are away after moving the cursor in the chart.
The complete chart has same color.
for (xIndex = 0; xIndex < nNumCol; xIndex++)
{
for (yIndex = 0; yIndex < nNumRow; yIndex++)
{
arrayIndex = xIndex + (yIndex * nNumCol);

if (arrayIndex < myDataSet.tDataArray[nPlotSet].nActDataNum)
{

dXVal = (double)myDataSet.tDataArray[nPlotSet].tDataPos[arrayIndex].nPosXMikroMeter / 1000.0;
dYVal = (double)myDataSet.tDataArray[nPlotSet].tDataPos[arrayIndex].nPosYMikroMeter / 1000.0;
dZVal = (double)myDataSet.tDataArray[nPlotSet].tDataValue[arrayIndex].profileMikroMeter / 1000.0;

surface1.Add(dXVal, dZVal, dYVal);
}
}
}

Best Regards
Christian Frank

messsysteme
Newbie
Newbie
Posts: 4
Joined: Tue Mar 18, 2025 12:00 am

Re: Problem with SurfaceNearest Tool

Post by messsysteme » Tue Aug 12, 2025 1:46 pm

Hello Marc,

now I tested with your start-code. Then I filled the values with:
for (int x = 0; x <= 50; x++)
for (int z = 0; z <= 50; z++)
{
y = -1.0 + 8.0 * (double)z / 50.0;
surface1.Add(x, y, z);
}
>> It works fine

Then I changed the range: (y=-1.0 >> y=0.0)

for (int x = 0; x <= 50; x++)
for (int z = 0; z <= 50; z++)
{
y = 0.0 + 8.0 * (double)z / 50.0;
surface1.Add(x, y, z);
}

and the problem comes again, all colors are same.
It seems, if the call to surfaceNearest overwrites all celles with the color of first cells.

Best Regards,
Christian Frank

Marc
Site Admin
Site Admin
Posts: 1338
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: Problem with SurfaceNearest Tool

Post by Marc » Wed Aug 13, 2025 2:39 pm

Hello Christian,

Thank you for the extra information. I am able to reproduce the problem and confirm that it is caused when the Y data value range shifts.

We're checking for the cause and possible solutions.

Regards,
Marc

Post Reply