BACKGROUND: SPIN PLOTS
I'm trying to create a "spin" chart using TChart. A spin chart lets an analyst view a 3D scatter plot and spin it around by pitch, yaw and roll. Here is an animated GIF that is a good illustration:
- macspin example.gif (140.35 KiB) Viewed 8439 times
With a modest number of points (up to 20 or 30, say), it would be desirable to be able to label each point. And that's where the challenge starts with TChart!!
NORMAL TCHART TOOLS
If I use normal TChart tools, plotted points look flat when we rotate 90 degrees. If we use OpenGL, text labels aren't drawn facing the viewer when we rotate, and vanish entirely once we rotate more than 90 degrees.
WHAT IF DRAW THE TEXT OURSELVES?
Here are some results using onAfterDraw to draw onto a chart that showing at an oblique angle:
Using a conventional chart:
-- TextOut(x, y, 'Hello') draws the text at a fixed x-y position on the chart. The text does not move as the chart is rotated.
-- TextOut3D(x, y, z, 'Hello') draws the text treating the x-y-z as chart coordinates, not canvas coordinates, so the text moves as the chart is rotated.
-- In both cases, the text is drawn facing the viewer (yea!)
Using an OpenGL chart created with TTeeOpenGL:
-- TextOut and TextOut3D appear to do exactly the same thing: the coordinates are treated as chart coords rather than canvas coords, so they move as the chart is rotated.
-- In both cases, the chart is drawn facing the original "outward" direction (towards positive-z). The text turns into a straight line when viewed at 90 degrees, and vanishes if we rotate any further.
-- I haven't found a way to draw text on an OpenGL chart that does NOT screw up the text when a chart is rotated.
CONCLUSIONS SO FAR
-- Given that we want 360 degree rotation with text labels, it seems using OpenGL and TTeeOpenGL is gorgeous, but worthless
-- In conventional charts, the only available point styles that can have depth (so they don't turn into lines at 90 degrees) are rectangle and triangle, NOT circles/spheres. So we can't draw a set of points without conveying a sense of the original axes (which is meaningless in most "spin" type applications.
-- The worst problem in conventional charts is that the z-ordering of drawn objects can get screwed up.
-- Solution? None yet, but I'm hopeful!
Given the huge breadth of styles and options in TChart, it's surprising that "spin" charts aren't a stock option.