Recent

Author Topic: Mark shapes and callouts  (Read 8521 times)

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Mark shapes and callouts
« on: September 08, 2012, 06:50:37 pm »
TAChart now offers much more control over the look of mark labels:
Added properties Marks.Margins, Marks.Shape and Marks.CalloutAngle (measured in tenths of degree, like Font.Orientation).
See "labels" demo since r38582 for an example. Please test.
There are some questions:
1) What (other) shapes should I add? TeeChart seems to support only rectangle, ellipse and roundrect, but with arbitrary rounding radius. I have implemented roundsides as an example, but I can think of various things like octagon, star-shapes etc. The problem is that complex shapes require additional (and different) parameters...
2) In principle, the code for series marks, axis marks, axis titles and chart titles is common, so these features could be made available for them all. However, some combinations might not be useful, like callout on title.
It would be nice if somebody tested/analyzed possible combinations of these (and perhaps some other, like Attachment) properties and suggested which ones should be published for which class.
3) LinePen is useless when CalloutAngle > 0 -- should it be turned invisible automatically?

Few TODOs/known issues:
1) Marks can now be me made non-symmetrical by changing Margins. However, some parts of measuring code still do not know that.
2) Ellipse arc tessellation would benefit form applying midpoint algorithm,
but it is not really straightforward, since I need arbitrary arcs of rotated ellipses,
and even the most advanced paper I found did discuss that case.

wp

  • Hero Member
  • *****
  • Posts: 11911
Re: Mark shapes and callouts
« Reply #1 on: September 16, 2012, 06:24:50 am »
Sorry for responding so late, I was travelling.

Quote
TAChart now offers much more control over the look of mark labels
Thank you - these are nice additions.

Quote
I can think of various things like octagon, star-shapes etc.
I fear this would be an endless journey, there are too many of them. What about user-drawn marks by means of events like
Code: [Select]
procedure OnDrawMark(Sender:TObject; const AText: String; const ARect:TRect);
procedure OnMeasureMark(Sender:TObject; const AText:String; var ARect:TRect);

Quote
code for series marks, axis marks, axis titles and chart titles is common, so these features could be made available for them all
Shape would be nice for the chart title and footer.

Sometimes I am missing a shadow to emphasize the title (but low priority).

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: Mark shapes and callouts
« Reply #2 on: September 16, 2012, 08:36:43 am »
Quote
I can think of various things like octagon, star-shapes etc.
I fear this would be an endless journey, there are too many of them.
Yes, but that is true for all programming :)

Quote from: wp
What about user-drawn marks by means of events
Added Marks.OnGetShape in in r38676.
See "labels" demo since rr38677.
Unfortunately, OnGetShape currently lack ability to defined per-point shapes.
This is harder to do (since it will require a specific event for every usage of marks),
so I'll postpone.

Quote from: wp
Shape would be nice for the chart title and footer.
Currently Shape is available for all kinds of marks, just not published for some.
Please try setting Title.Shape from code -- if you think results are useful, I'll publish it.

Quote from: wp
Sometimes I am missing a shadow to emphasize the title (but low priority).
The problem with shadow (as well as gradient, another long-requested feature)
is that it may have a lot of parameters (although not as many as gradient),
which depend on:
1) Desired visual effect (transparency level, fuzzy vs sharp, depth/direction...)
2) Object casting the shadow (label, legend, 2-D bar series, 3-D bar series...)
3) Drawing back-end (e.g. transparent shadows are easy for BGRA, but hard for default canvas...)

So I need a good design on both API and architecture level for this,
or, perhaps, a well-justified "good enough" feature subset, which is
easy to implement but is still useful in all applicable cases and extendable in the future.

For example, I have currently implemented transparency per-series only
based on "minimal useful subset" approach, and it still took
r38597, r38596, r38590, r38472, r38471, r38470, r38463, r38459, r38454, r38453.
See especially TCanvasDrawer.SetTransparency code.

wp

  • Hero Member
  • *****
  • Posts: 11911
Re: Mark shapes and callouts
« Reply #3 on: September 17, 2012, 01:51:56 am »
Quote
Added Marks.OnGetShape in in r38676.
See "labels" demo since rr38677.
Perfect. Thank you.

Quote
if you think results are useful, I'll publish it.
I'd appreciate that.

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: Mark shapes and callouts
« Reply #4 on: September 17, 2012, 05:48:33 am »
Quote
if you think results are useful, I'll publish it.
I'd appreciate that.

Done in r38708

CM630

  • Hero Member
  • *****
  • Posts: 1089
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Mark shapes and callouts
« Reply #5 on: September 18, 2012, 10:31:53 am »
1) What (other) shapes should I add? TeeChart seems to support only rectangle, ellipse and roundrect, but with arbitrary rounding radius.
I did not read the entire thread , but the second that I thought is that you could add characters, since some fonts contain nothing but shapes. Of course, this might cause some multi-platform problems.
The firsts that I thought is already offered to you by @wp  8)
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

wp

  • Hero Member
  • *****
  • Posts: 11911
Re: Mark shapes and callouts
« Reply #6 on: September 18, 2012, 11:27:42 am »
I think that's not very useful because you cannot use these symbols to surround other text - at least sound very complicated to achieve...

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: Mark shapes and callouts
« Reply #7 on: September 18, 2012, 11:51:35 am »
@paskal: yes, you have probably meant to use symbols for pointers, while this topic is about shapes of labels.

Using symbols as pointers is a good idea in itself. I think it can already achieved by careful label placement, but perhaps it merits a separate feature.

CM630

  • Hero Member
  • *****
  • Posts: 1089
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Mark shapes and callouts
« Reply #8 on: September 18, 2012, 12:45:18 pm »
@paskal: yes, you have probably meant to use symbols for pointers, while this topic is about shapes of labels.
Right guess!

I think that's not very useful because you cannot use these symbols to surround other text - at least sound very complicated to achieve...
Well, as @Ask said, I did a mistake. Anyway, your post hinted me, that it is not obligatory to surround the text. The character might be used as a background.
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

 

TinyPortal © 2005-2018