Chart - Marker color [message #32410] |
Mon, 02 May 2005 11:42  |
Eclipse User |
|
|
|
Originally posted by: nicholas.gauthier.utah.edu
Does anyone know how to specify the color of the points in a scatter
plot chart? I have experimented with
Series.getMarker().setShadowColor(ColorDefinitionImpl.BLACK( ));
but to no avail...
Thanks in advance! Nick.
|
|
|
|
|
|
Re: Chart - Marker color [message #34167 is a reply to message #33847] |
Wed, 04 May 2005 12:51   |
Eclipse User |
|
|
|
Originally posted by: nicholas.gauthier.utah.edu
Great thanks!
One more question. Is it possible to change the marker type of a single
point in a series (ie. from square to circle)? Thanks again...
Here is the code I used for anyone curious...
The first function 'beforeDrawElement(dataPointHints, fill)' will change
the color of all the points greater then 10 on the orthogonal axis.
The second function 'beforeDrawDataPoint(dataPointHints, fill)' will
change the color of the point's labels where the point is greater then
10 on the orthogonal axis.
*****************************************
Chart chart = ....
chart.setScript(
"function beforeDrawElement(dataPointHints, fill){" +
"val = dataPointHints.getOrthogonalValue();" +
"if (val < 10){ " +
"fill.set(255, 0, 0);" +
"logger.logFromScript('setting val:' + val + '
color');" +
"}" +
"else{" +
"fill.set(0, 0, 0);" +
"}" +
"}"
"function beforeDrawDataPoint(dataPointHints, label) { " +
"val = dataPointHints.getOrthogonalValue(); " +
"label.getCaption().setValue('hello');" +
"clr = label.getCaption().getColor(); " +
"if (val < 10) " +
"clr.set(255, 0, 0); " +
"else clr.set(0, 0, 255); " +
"}"
);
*****************************************
Nick.
Rohit Colaço wrote:
>
> Nick,
>
> If you want to 'override' the default colors at runtime depending on the
> value of each marker for your custom business logic, you may want to use
> custom scripting by overriding the following functions:
>
> function beforeDrawElement(dataPointHints, fill)
> {
> if (dataPointHints ...)
> {
> fill = ... // custom user color
> }
> }
>
> function afterDrawElement(dataPointHints, fill)
> {
> if (dataPointHints ...)
> {
> fill = ... // restore previous color
> }
> }
>
> You may set the script into the chart model as one big block of text.
>
> Chart cm = ...;
> cm.setScript("function beforeDrawElement(dataPointHints,
> fill)\r\n{\r\n\tif...
>
> Regards,
>
> - Rohit
>
>
> ---
>
> Subject: Re: Chart - Marker color
> From: nicholas.gauthier@xxxxxxxxxxxx (Nicholas Gauthier)
> Newsgroups: eclipse.birt
> Organization: EclipseCorner
> Date: May 03 2005 16:21:39
>
> So in a single series can one specify half of the markers to be one
> color and half a different color? What I am actually looking to do is
> to highlight specific markers...
>
> Thanks, Nick.
>
>
|
|
|
Re: Chart - Marker color [message #35177 is a reply to message #34167] |
Fri, 06 May 2005 16:19  |
Eclipse User |
|
|
|
Nicholas,
You could hook into the javascript functions:
beforeDrawElement
afterDrawElement
... to set and restore the series marker style based on your custom
business logic.
Note that this may be out-of-sync with the graphic element corresponding
to the series that is rendered in the legend.
Regards,
- Rohit
---
Subject: Re: Chart - Marker color
From: nicholas.gauthier@xxxxxxxxxxxx (Nicholas Gauthier)
Newsgroups: eclipse.birt
Organization: EclipseCorner
Date: May 04 2005 11:51:42
Great thanks!
One more question. Is it possible to change the marker type of a single
point in a series (ie. from square to circle)? Thanks again...
Here is the code I used for anyone curious...
The first function 'beforeDrawElement(dataPointHints, fill)' will change
the color of all the points greater then 10 on the orthogonal axis.
The second function 'beforeDrawDataPoint(dataPointHints, fill)' will
change the color of the point's labels where the point is greater then 10
on the orthogonal axis.
|
|
|
Powered by
FUDForum. Page generated in 0.04256 seconds