Skip to main content



      Home
Home » Archived » BIRT » Chart - Marker color
Chart - Marker color [message #32410] Mon, 02 May 2005 11:42 Go to next message
Eclipse UserFriend
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 #32654 is a reply to message #32410] Mon, 02 May 2005 10:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mpadhye.actuate.com

Nicholas Gauthier wrote:
> 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.
Hi Nicholas,

The marker colors (and indeed colors for all the series elements like
bars, pie slices etc.) are picked up from the series palette.

As such, the way to set the colors for a set of markers is to add / set
the color into the series palette as follows:

SeriesDefinition.getSeriesPalette().getEntries().add(Fill fill);

If a series definition is going to result in multiple runtime series,
the index of the resulting series determines the index of the fill in
the palette that will be used for it's elements.

So, the markers / bars of the third series will use the third entry in
the palette. (NOTE: Entry indexes in the palette are '0' based).

Hope this helps.

Thanks,
Milind
Re: Chart - Marker color [message #33779 is a reply to message #32654] Tue, 03 May 2005 17:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: nicholas.gauthier.utah.edu

Milind Padhye wrote:
> Nicholas Gauthier wrote:
>
>> 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.
>
> Hi Nicholas,
>
> The marker colors (and indeed colors for all the series elements
> like bars, pie slices etc.) are picked up from the series palette.
>
> As such, the way to set the colors for a set of markers is to add /
> set the color into the series palette as follows:
>
> SeriesDefinition.getSeriesPalette().getEntries().add(Fill fill);
>
> If a series definition is going to result in multiple runtime
> series, the index of the resulting series determines the index of the
> fill in the palette that will be used for it's elements.
>
> So, the markers / bars of the third series will use the third entry
> in the palette. (NOTE: Entry indexes in the palette are '0' based).
>
> Hope this helps.
>
> Thanks,
> Milind


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 #33847 is a reply to message #33779] Tue, 03 May 2005 20:04 Go to previous messageGo to next message
Eclipse UserFriend
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 #34167 is a reply to message #33847] Wed, 04 May 2005 12:51 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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.
Previous Topic:Adding my own templates to the report template wizard, no extension point?
Next Topic:Problem propagate report parameter to sql data set
Goto Forum:
  


Current Time: Fri May 09 19:09:54 EDT 2025

Powered by FUDForum. Page generated in 0.04256 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top