Recent

Author Topic: tchart legend & pointers  (Read 15261 times)

mmab

  • Jr. Member
  • **
  • Posts: 89
tchart legend & pointers
« on: September 25, 2010, 04:39:00 am »
Hi,
I've noticed an unusual behavior of tchart legend.
A line series with a pointer is not properly drawn in the legend field. I can only obtain the line color not the pointer. I guess this is a missing part. I tried to check it if it is still missing at the daily snapshot but looks like http://www.hu.freepascal.org/lazarus/ is not responding.
I also would like to see a bunch of different pointers such as triangle, left/right triangle.

But, I'd like to congratulate for the efforts to Tchart. I hope 3D plotting will be added in near future. (I can share some info such as Z-buffer on this topic)

Thanks.
MMAB
 

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: tchart legend & pointers
« Reply #1 on: September 26, 2010, 03:51:44 am »
Hi,
I've noticed an unusual behavior of tchart legend.
A line series with a pointer is not properly drawn in the legend field. I can only obtain the line color not the pointer. I guess this is a missing part. I tried to check it if it is still missing at the daily snapshot but looks like http://www.hu.freepascal.org/lazarus/ is not responding.

You are right, this was a TODO item, (you can see a list of them on the wiki).
Implemented in r27461-27462, should be available in the next snapshot.

I also would like to see a bunch of different pointers such as triangle, left/right triangle.

Added those in r27463. Note that you can create custom pointers via OnShowPointer event.

I hope 3D plotting will be added in near future.

Which kind of 3D plot do you need?
TAChart already has support for 3D versions of line, bar and area series.

I can share some info such as Z-buffer on this topic

Chart drawing is a typical application of painter's algorithm, so Z-buffer in not needed.
On the other hand, moving to full OpenGL implementation would be interesting,
but require nearly total rewrite, so is not likely to happen soon.


Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: tchart legend & pointers
« Reply #3 on: September 27, 2010, 05:13:48 am »
The 3D I mean is a line, a bar or a surface

Lines and bars already work, see demo/3d.
Surface, on the other hand, is not even planned yet.

mmab

  • Jr. Member
  • **
  • Posts: 89
Re: tchart legend & pointers
« Reply #4 on: September 27, 2010, 05:43:20 am »
Thanks for the info.
I've downloaded the latest trunk version and I've noticed that you've solved the legend issue.

I've developed a basic project with two charts on the same form, I've selected animate option at zoom for both. Whenever I zoom to one of charts, I no longer zoom in at the other chart. Is this a bug? What do you think?

I knew the 3d look demo. I am not mentioning the 3d look, actual 3d plot, for example: a line that describes a helix

x=3cos 3t
y=3sin 3t
z=t
0<t<pi

I do have a 3d example for a wire surface, (which is basically plot of lines) including azimuth, elevation implementation. I can provide it if you need.

Thanks.
MMAB
 



Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: tchart legend & pointers
« Reply #5 on: September 28, 2010, 10:50:50 pm »
I've developed a basic project with two charts on the same form, I've selected animate option at zoom for both. Whenever I zoom to one of charts, I no longer zoom in at the other chart. Is this a bug?

Probably yes, but I can not easily reproduce it.
Can you please create a bug report and attach a demo project to it?

I knew the 3d look demo. I am not mentioning the 3d look, actual 3d plot, for example: a line that describes a helix
x=3cos 3t
y=3sin 3t
z=t
0<t<pi
I do have a 3d example for a wire surface, (which is basically plot of lines) including azimuth, elevation implementation. I can provide it if you need.

Hm, so you want parametrically defined surfaces?
This is even more complex than functional surfaces you requested
in the previous message :-)

You can add a feature request for that, but I do not promise it will be implemented soon.
To speed it up, what I need is not the sample of wireframe drawing code --
this is the easy part. The complex question is how should it interact with
other series and chart properties, in particular with axis transformations etc.
If course, an actual patch may things speed up even more :-)

mmab

  • Jr. Member
  • **
  • Posts: 89
Re: tchart legend & pointers
« Reply #6 on: September 29, 2010, 04:41:33 am »

Here it is : http://mantis.freepascal.org/view.php?id=17507


I guess the complex question is how to draw the 3D surface. I'm not an expert on this, but it seems to me it'd be better to use two canvas (or a 2d matrix if you like), one is to keep info of the distance to camera or viewscene of the pixels, the other one is for actual visible plot.


mmab

  • Jr. Member
  • **
  • Posts: 89
Re: tchart legend & pointers
« Reply #7 on: September 30, 2010, 02:29:49 am »

 I'd like to add a request for the pointers:
 for a huge amount of data (10000-50000 data points) the chart becomes so crowded due to the pointers since every data point has a pointer assigned, it would be nice to have a pointer draw frequency. i.e
instead of drawing the pointer for all data, plotting only the pointers with multiple of a frequency assigned by user :

Code: [Select]
begin
  i:=0;
   repeat
    Drawpointer_for_data(...);
    i:=i+frequency;
  until i>=length(data);
end;


thanks
MMAB

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: tchart legend & pointers
« Reply #8 on: September 30, 2010, 11:35:20 am »
Quote
a huge amount of data (10000-50000 data points)

You do realize that this is about 10-100 data points *per pixel*?
Such chart would be totally incomprehensible except for extreme zoom-in levels.
And if you zoom in enough, pointers became less overlapped too.

So, can you describe the problem more completely -- what are you
trying to achieve by building such a chart?
Maybe what you really need is a more general "overview mode",
where too-dense series are automatically (or manually) replaced by
a coarse-grained versions to allow user to select an appropriate area to zoom into?

In other words, I think the feature you propose is too niche and suggest
you think of a more general feature instead ;-)

That said, you can already do exactly what you asked for:
1) Set ShowPoints=true, Pointer.Style=psNone
2) In OnDrawPointer pointer event, draw a pointer only if
  AIndex mod FYourFrequency = 0


mmab

  • Jr. Member
  • **
  • Posts: 89
Re: tchart legend & pointers
« Reply #9 on: September 30, 2010, 09:04:19 pm »

I tried to draw 100k points but the application cannot respond, I first thought of the pointer drawing is the bottle neck of the code.
So you

Quote
So, can you describe the problem more completely -- what are you
trying to achieve by building such a chart?
Maybe what you really need is a more general "overview mode",
where too-dense series are automatically (or manually) replaced by
a coarse-grained versions to allow user to select an appropriate area to zoom into?

I wanted to mention this to bring out the development of fast drawing series, i.e if a couple of x values corresponds to a same pixel column then, take min and max of the data (to identify max and min y pixels to draw) for that couple and use it for pixel drawing.

Thanks.
MMAB

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: tchart legend & pointers
« Reply #10 on: October 04, 2010, 01:48:20 pm »
I fixed zooming bug, please test and close the issue if ok.

I tried to draw 100k points but the application cannot respond, I first thought of the pointer drawing is the bottle neck of the code.

That's right, very long series should not display pointers for fast drawing.

I wanted to mention this to bring out the development of fast drawing series, i.e if a couple of x values corresponds to a same pixel column then, take min and max of the data (to identify max and min y pixels to draw) for that couple and use it for pixel drawing.

Line drawing is already optimized for the simple cases, and should be quite fast.
See linedemo for a timed example.

I tried the optimization you suggested, but did not achieve any speed-up.
I guess that polyline drawing already joins successive horizontal and
vertical segments.

 

TinyPortal © 2005-2018