Mark shapes and callouts lazarus / 55-TAChart ---------------------------------------------------------------------- Ask · 2012-09-08 16:50 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 · 2012-09-16 04:24 Sorry for responding so late, I was travelling. QuoteTAChart 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); Quotecode for series marks, axis marks, axis titles and chart titles is common, so these features could be made available for them allShape would be nice for the chart title and footer. Sometimes I am missing a shadow to emphasize the title (but low priority). ---------------------------------------------------------------------- Ask · 2012-09-16 06:36 Quote from: wp on September 16, 2012, 06:24:50 amQuote 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: wpWhat about user-drawn marks by means of eventsAdded 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: wpShape 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: wpSometimes 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 · 2012-09-16 23:51 QuoteAdded Marks.OnGetShape in in r38676. See "labels" demo since rr38677. Perfect. Thank you. Quoteif you think results are useful, I'll publish it. I'd appreciate that. ---------------------------------------------------------------------- Ask · 2012-09-17 03:48 Quote from: wp on September 17, 2012, 01:51:56 amQuoteif you think results are useful, I'll publish it. I'd appreciate that. Done in r38708 ---------------------------------------------------------------------- CM630 · 2012-09-18 08:31 Quote from: Ask on September 08, 2012, 06:50:37 pm1) 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 ---------------------------------------------------------------------- wp · 2012-09-18 09:27 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 · 2012-09-18 09:51 @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 · 2012-09-18 10:45 Quote from: Ask 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. Right guess! Quote from: wp on September 18, 2012, 11:27:42 amI 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.