Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Problem with scatter charts
Problem with scatter charts [message #833642] Sat, 31 March 2012 20:43 Go to next message
Nigel Daniels is currently offline Nigel DanielsFriend
Messages: 66
Registered: July 2009
Member
Hi,

I am new to using Birt and I am trying to use the chart engine to draw
several data-sets on a scatter chart. I am trying to represent the first
set which has two X,Y points, one at (100, 0) and one at (100, 2922.5).

I based this on the scatter chart in the Birt examples and expected to
see one point above the other but I get a very strange result (see
attached). It looks like Birt is using the X axis as a grouping not as a
numeric sequence.

What do I need to do to get Birt to plot the point on a chart, treating
both axies as regular series?

If any one has an example I could take a look at it would help as I am
new to the Birt APIs.

Thanks, Nigel.
  • Attachment: Chart.png
    (Size: 23.68KB, Downloaded 356 times)
Re: Problem with scatter charts [message #834013 is a reply to message #833642] Sun, 01 April 2012 08:59 Go to previous messageGo to next message
Nigel Daniels is currently offline Nigel DanielsFriend
Messages: 66
Registered: July 2009
Member
Hi,

experimenting with the Chart builder UI solved my previous problem but
then ran me right into the next one. What I want to do is represent five
separate items on the chart, four of them are dual point lines like the
one below and the final one is a track of actual data that should stay
in these boundaries. In excel I can do this (see excel.png). Can this
sort of plot be recreated in BIRT?

In the Chart UI I can set multiple Y Series but it looks like BIRT only
handles one X Series?


Any suggestions,

Nigel

On 31/03/2012 21:43, Nigel Daniels wrote:
> Hi,
>
> I am new to using Birt and I am trying to use the chart engine to draw
> several data-sets on a scatter chart. I am trying to represent the first
> set which has two X,Y points, one at (100, 0) and one at (100, 2922.5).
>
> I based this on the scatter chart in the Birt examples and expected to
> see one point above the other but I get a very strange result (see
> attached). It looks like Birt is using the X axis as a grouping not as a
> numeric sequence.
>
> What do I need to do to get Birt to plot the point on a chart, treating
> both axies as regular series?
>
> If any one has an example I could take a look at it would help as I am
> new to the Birt APIs.
>
> Thanks, Nigel.
  • Attachment: Excel.png
    (Size: 36.40KB, Downloaded 296 times)
Re: Problem with scatter charts [message #835695 is a reply to message #834013] Tue, 03 April 2012 15:02 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Do you mean like the attached example?
I used three series and two marker lines.

Jason


On 4/1/2012 4:59 AM, Nigel Daniels wrote:
> Hi,
>
> experimenting with the Chart builder UI solved my previous problem but
> then ran me right into the next one. What I want to do is represent five
> separate items on the chart, four of them are dual point lines like the
> one below and the final one is a track of actual data that should stay
> in these boundaries. In excel I can do this (see excel.png). Can this
> sort of plot be recreated in BIRT?
>
> In the Chart UI I can set multiple Y Series but it looks like BIRT only
> handles one X Series?
>
>
> Any suggestions,
>
> Nigel
>
> On 31/03/2012 21:43, Nigel Daniels wrote:
>> Hi,
>>
>> I am new to using Birt and I am trying to use the chart engine to draw
>> several data-sets on a scatter chart. I am trying to represent the first
>> set which has two X,Y points, one at (100, 0) and one at (100, 2922.5).
>>
>> I based this on the scatter chart in the Birt examples and expected to
>> see one point above the other but I get a very strange result (see
>> attached). It looks like Birt is using the X axis as a grouping not as a
>> numeric sequence.
>>
>> What do I need to do to get Birt to plot the point on a chart, treating
>> both axies as regular series?
>>
>> If any one has an example I could take a look at it would help as I am
>> new to the Birt APIs.
>>
>> Thanks, Nigel.
>
Re: Problem with scatter charts [message #837356 is a reply to message #835695] Thu, 05 April 2012 15:20 Go to previous messageGo to next message
Nigel Daniels is currently offline Nigel DanielsFriend
Messages: 66
Registered: July 2009
Member
Hi Jason,

I do mean like the attached example. In the example all of the lines are
dynamic, even the markers as their 'end points' change according to the
data the actual track against.

The main problem I hit in trying to create this was the shared X values.

I think others have pointed out ways of using different size datasets.
Assuming I know the maximum data set size I can try padding the others
with NaN.

However I have not go that far with Birt due to the first problem.
Currently I'm using SWTGraph as that seems to handle this situation very
easily.

Best regards,

Nigel


On 03/04/2012 16:02, Jason Weathersby wrote:
> Do you mean like the attached example?
> I used three series and two marker lines.
>
> Jason
>
>
> On 4/1/2012 4:59 AM, Nigel Daniels wrote:
>> Hi,
>>
>> experimenting with the Chart builder UI solved my previous problem but
>> then ran me right into the next one. What I want to do is represent five
>> separate items on the chart, four of them are dual point lines like the
>> one below and the final one is a track of actual data that should stay
>> in these boundaries. In excel I can do this (see excel.png). Can this
>> sort of plot be recreated in BIRT?
>>
>> In the Chart UI I can set multiple Y Series but it looks like BIRT only
>> handles one X Series?
>>
>>
>> Any suggestions,
>>
>> Nigel
>>
>> On 31/03/2012 21:43, Nigel Daniels wrote:
>>> Hi,
>>>
>>> I am new to using Birt and I am trying to use the chart engine to draw
>>> several data-sets on a scatter chart. I am trying to represent the first
>>> set which has two X,Y points, one at (100, 0) and one at (100, 2922.5).
>>>
>>> I based this on the scatter chart in the Birt examples and expected to
>>> see one point above the other but I get a very strange result (see
>>> attached). It looks like Birt is using the X axis as a grouping not as a
>>> numeric sequence.
>>>
>>> What do I need to do to get Birt to plot the point on a chart, treating
>>> both axies as regular series?
>>>
>>> If any one has an example I could take a look at it would help as I am
>>> new to the Birt APIs.
>>>
>>> Thanks, Nigel.
>>
>
Re: Problem with scatter charts [message #837460 is a reply to message #837356] Thu, 05 April 2012 17:44 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

If you turn off aggregation on the chart you can share x vals with a
scatter chart it the x axis is set to linear. Take a look at the
attached example. I also attached the example I did yesterday updated
to use a scatter chart.

Jason

On 4/5/2012 11:21 AM, Nigel Daniels wrote:
> Hi Jason,
>
> I do mean like the attached example. In the example all of the lines are
> dynamic, even the markers as their 'end points' change according to the
> data the actual track against.
>
> The main problem I hit in trying to create this was the shared X values.
>
> I think others have pointed out ways of using different size datasets.
> Assuming I know the maximum data set size I can try padding the others
> with NaN.
>
> However I have not go that far with Birt due to the first problem.
> Currently I'm using SWTGraph as that seems to handle this situation very
> easily.
>
> Best regards,
>
> Nigel
>
>
> On 03/04/2012 16:02, Jason Weathersby wrote:
>> Do you mean like the attached example?
>> I used three series and two marker lines.
>>
>> Jason
>>
>>
>> On 4/1/2012 4:59 AM, Nigel Daniels wrote:
>>> Hi,
>>>
>>> experimenting with the Chart builder UI solved my previous problem but
>>> then ran me right into the next one. What I want to do is represent five
>>> separate items on the chart, four of them are dual point lines like the
>>> one below and the final one is a track of actual data that should stay
>>> in these boundaries. In excel I can do this (see excel.png). Can this
>>> sort of plot be recreated in BIRT?
>>>
>>> In the Chart UI I can set multiple Y Series but it looks like BIRT only
>>> handles one X Series?
>>>
>>>
>>> Any suggestions,
>>>
>>> Nigel
>>>
>>> On 31/03/2012 21:43, Nigel Daniels wrote:
>>>> Hi,
>>>>
>>>> I am new to using Birt and I am trying to use the chart engine to draw
>>>> several data-sets on a scatter chart. I am trying to represent the
>>>> first
>>>> set which has two X,Y points, one at (100, 0) and one at (100, 2922.5).
>>>>
>>>> I based this on the scatter chart in the Birt examples and expected to
>>>> see one point above the other but I get a very strange result (see
>>>> attached). It looks like Birt is using the X axis as a grouping not
>>>> as a
>>>> numeric sequence.
>>>>
>>>> What do I need to do to get Birt to plot the point on a chart, treating
>>>> both axies as regular series?
>>>>
>>>> If any one has an example I could take a look at it would help as I am
>>>> new to the Birt APIs.
>>>>
>>>> Thanks, Nigel.
>>>
>>
>
Re: Problem with scatter charts [message #903404 is a reply to message #837460] Thu, 23 August 2012 13:52 Go to previous messageGo to next message
ju seb is currently offline ju sebFriend
Messages: 7
Registered: August 2012
Junior Member
Hello!

I need to do the same thing, but with text values in x axis -> the labels that are equals are not grouped, they appear many times in x axis with only one value y...
Any idea how to have the same result as for linear axis??

Thanks
Re: Problem with scatter charts [message #903442 is a reply to message #903404] Thu, 23 August 2012 16:21 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Are you aggregating the x-axis. Take a look at the attached screenshot.

Jason

On 8/23/2012 9:52 AM, ju seb wrote:
> Hello!
>
> I need to do the same thing, but with text values in x axis -> the
> labels that are equals are not grouped, they appear many times in x axis
> with only one value y...
> Any idea how to have the same result as for linear axis??
>
> Thanks
Re: Problem with scatter charts [message #903447 is a reply to message #903442] Thu, 23 August 2012 16:41 Go to previous messageGo to next message
ju seb is currently offline ju sebFriend
Messages: 7
Registered: August 2012
Junior Member
Thank you for your quick response!
I am not aggregating on x, should i?? as aggregation have to be disabled to do the scatter chart with linear axis, i've done exactly the same for a text axis... but the y values that have the same x don't appear on the same column since each x is repeated.

I also tried "optional Y series grouping" on x, the chart is displayed the same way, except each y value of the same x has the same color -> that means BIRT recognize the same x values, but why it doesn't put them on the same abscissa?..
Re: Problem with scatter charts [message #903451 is a reply to message #833642] Thu, 23 August 2012 16:48 Go to previous messageGo to next message
ju seb is currently offline ju sebFriend
Messages: 7
Registered: August 2012
Junior Member
Well, i realize my question was not very clear when I said "I want to do the same thing with text axis values, i refered to:
Nigel Daniels wrote on Sat, 31 March 2012 16:43
Hi,

I am new to using Birt and I am trying to use the chart engine to draw
several data-sets on a scatter chart. I am trying to represent the first
set which has two X,Y points, one at (100, 0) and one at (100, 2922.5).

I based this on the scatter chart in the Birt examples and expected to
see one point above the other but I get a very strange result (see
attached). It looks like Birt is using the X axis as a grouping not as a
numeric sequence.


My problem is that, for two points (A,10) and (A,20) the points are not one above the other, since two "A" abscissa are displayed side by side.
Re: Problem with scatter charts [message #903452 is a reply to message #903447] Thu, 23 August 2012 16:49 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

I am not sure what you mean. Look at the attached example. The second
chart is a text axis with aggregation enabled. The first is not
aggregated and it uses a linear x-axis.


On 8/23/2012 12:41 PM, ju seb wrote:
> Thank you for your quick response!
> I am not aggregating on x, should i?? as aggregation have to be disabled
> to do the scatter chart with linear axis, i've done exactly the same for
> a text axis... but the y values that have the same x don't appear on the
> same column since each x is repeated.
>
> I also tried "optional Y series grouping" on x, the chart is displayed
> the same way, except each y value of the same x has the same color ->
> that means BIRT recognize the same x values, but why it doesn't put them
> on the same abscissa?..
Re: Problem with scatter charts [message #903454 is a reply to message #833642] Thu, 23 August 2012 16:48 Go to previous messageGo to next message
ju seb is currently offline ju sebFriend
Messages: 4
Registered: April 2012
Junior Member
Well, i realize my question was not very clear when I said "I want to do the same thing with text axis values, i refered to:
Nigel Daniels wrote on Sat, 31 March 2012 16:43
> Hi,
>
> I am new to using Birt and I am trying to use the chart engine to draw
> several data-sets on a scatter chart. I am trying to represent the first
> set which has two X,Y points, one at (100, 0) and one at (100, 2922.5).
>
> I based this on the scatter chart in the Birt examples and expected to
> see one point above the other but I get a very strange result (see
> attached). It looks like Birt is using the X axis as a grouping not as a
> numeric sequence.


My problem is that, for two points (A,10) and (A,20) the points are not one above the other, since two "A" abscissa are displayed side by side.
Re: Problem with scatter charts [message #903455 is a reply to message #903447] Thu, 23 August 2012 16:49 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

I am not sure what you mean. Look at the attached example. The second
chart is a text axis with aggregation enabled. The first is not
aggregated and it uses a linear x-axis.


On 8/23/2012 12:41 PM, ju seb wrote:
> Thank you for your quick response!
> I am not aggregating on x, should i?? as aggregation have to be disabled
> to do the scatter chart with linear axis, i've done exactly the same for
> a text axis... but the y values that have the same x don't appear on the
> same column since each x is repeated.
>
> I also tried "optional Y series grouping" on x, the chart is displayed
> the same way, except each y value of the same x has the same color ->
> that means BIRT recognize the same x values, but why it doesn't put them
> on the same abscissa?..
Re: Problem with scatter charts [message #903456 is a reply to message #833642] Thu, 23 August 2012 16:48 Go to previous messageGo to next message
ju seb is currently offline ju sebFriend
Messages: 4
Registered: April 2012
Junior Member
Well, i realize my question was not very clear when I said "I want to do the same thing with text axis values, i refered to:
Nigel Daniels wrote on Sat, 31 March 2012 16:43
> Hi,
>
> I am new to using Birt and I am trying to use the chart engine to draw
> several data-sets on a scatter chart. I am trying to represent the first
> set which has two X,Y points, one at (100, 0) and one at (100, 2922.5).
>
> I based this on the scatter chart in the Birt examples and expected to
> see one point above the other but I get a very strange result (see
> attached). It looks like Birt is using the X axis as a grouping not as a
> numeric sequence.


My problem is that, for two points (A,10) and (A,20) the points are not one above the other, since two "A" abscissa are displayed side by side.
Re: Problem with scatter charts [message #903457 is a reply to message #903447] Thu, 23 August 2012 16:49 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

I am not sure what you mean. Look at the attached example. The second
chart is a text axis with aggregation enabled. The first is not
aggregated and it uses a linear x-axis.


On 8/23/2012 12:41 PM, ju seb wrote:
> Thank you for your quick response!
> I am not aggregating on x, should i?? as aggregation have to be disabled
> to do the scatter chart with linear axis, i've done exactly the same for
> a text axis... but the y values that have the same x don't appear on the
> same column since each x is repeated.
>
> I also tried "optional Y series grouping" on x, the chart is displayed
> the same way, except each y value of the same x has the same color ->
> that means BIRT recognize the same x values, but why it doesn't put them
> on the same abscissa?..
Re: Problem with scatter charts [message #903461 is a reply to message #833642] Thu, 23 August 2012 16:48 Go to previous messageGo to next message
ju seb is currently offline ju sebFriend
Messages: 4
Registered: April 2012
Junior Member
Well, i realize my question was not very clear when I said "I want to do the same thing with text axis values, i refered to:
Nigel Daniels wrote on Sat, 31 March 2012 16:43
> Hi,
>
> I am new to using Birt and I am trying to use the chart engine to draw
> several data-sets on a scatter chart. I am trying to represent the first
> set which has two X,Y points, one at (100, 0) and one at (100, 2922.5).
>
> I based this on the scatter chart in the Birt examples and expected to
> see one point above the other but I get a very strange result (see
> attached). It looks like Birt is using the X axis as a grouping not as a
> numeric sequence.


My problem is that, for two points (A,10) and (A,20) the points are not one above the other, since two "A" abscissa are displayed side by side.
Re: Problem with scatter charts [message #903462 is a reply to message #903447] Thu, 23 August 2012 16:49 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

I am not sure what you mean. Look at the attached example. The second
chart is a text axis with aggregation enabled. The first is not
aggregated and it uses a linear x-axis.


On 8/23/2012 12:41 PM, ju seb wrote:
> Thank you for your quick response!
> I am not aggregating on x, should i?? as aggregation have to be disabled
> to do the scatter chart with linear axis, i've done exactly the same for
> a text axis... but the y values that have the same x don't appear on the
> same column since each x is repeated.
>
> I also tried "optional Y series grouping" on x, the chart is displayed
> the same way, except each y value of the same x has the same color ->
> that means BIRT recognize the same x values, but why it doesn't put them
> on the same abscissa?..
Re: Problem with scatter charts [message #903528 is a reply to message #903462] Fri, 24 August 2012 07:12 Go to previous messageGo to next message
ju seb is currently offline ju sebFriend
Messages: 7
Registered: August 2012
Junior Member
You can see in the capture what I need to do : a text X axis, xith many Y values for each X. Those values should appear, not aggregated, one above the other.

index.php/fa/11292/0/
Re: Problem with scatter charts [message #903616 is a reply to message #903528] Fri, 24 August 2012 14:43 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

This appears to be a bug with x-axis being text based. If you can post
a csv of your data I may be able to help with a script work around. Do
you mind opening a bugzilla entry for this?

Jason

On 8/24/2012 3:12 AM, ju seb wrote:
> You can see in the capture what I need to do : a text X axis, xith many Y values for each X. Those values should appear, not aggregated, one above the other.
>
>
Re: Problem with scatter charts [message #903622 is a reply to message #903616] Fri, 24 August 2012 15:05 Go to previous messageGo to next message
ju seb is currently offline ju sebFriend
Messages: 7
Registered: August 2012
Junior Member
This is just a screenshot the client gave to me as an example. You can try with (A,1), (A,2),(B,4),(B,5) for instance.
The best thing i made for the moment is to group Y values by x, the y values for a same x are still side by side instead of one above the other, but they are have the same color by group -> so BIRT is able to see that A=A, i just don't know why it can't do as for linear axis...
Re: Problem with scatter charts [message #903641 is a reply to message #903622] Fri, 24 August 2012 16:08 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

One way around this would be to create a computed column on the dataset
that converts the string to an int using ascii code. Use the code as
the x-axis values letting you set it to a linear. In the computed
column you would also store a persistent variable with code as the
variable name and the string as the value. You can then look up the
value in the beforeDrawAxisLabel and convert it back. This is a bit
ugly though.

Jason


On 8/24/2012 11:05 AM, ju seb wrote:
> This is just a screenshot the client gave to me as an example. You can
> try with (A,1), (A,2),(B,4),(B,5) for instance. The best thing i made
> for the moment is to group Y values by x, the y values for a same x are
> still side by side instead of one above the other, but they are have the
> same color by group -> so BIRT is able to see that A=A, i just don't
> know why it can't do as for linear axis...
Re: Problem with scatter charts [message #904345 is a reply to message #903641] Tue, 28 August 2012 09:37 Go to previous messageGo to next message
ju seb is currently offline ju sebFriend
Messages: 7
Registered: August 2012
Junior Member
Hi!
Thank you for this good idea! I tried to implement it like that:
- define a parameter WptNbCurrent1 (integer) initialized to 0, which will contain the x values: it is incremented each time we fetch a different x value
(my x values are ordered by name)
- in the onFetch script of my query:
if(reportContext.getPersistentGlobalVariable(row["x"]) == null){
	params["WptNbCurrent1"].value = new Number(params["WptNbCurrent1"].value) +1;
	reportContext.setPersistentGlobalVariable(row["x"], params["WptNbCurrent1"].value+"");
	reportContext.setPersistentGlobalVariable(params["WptNbCurrent1"].value+"", row["x"]);
}

- I defined a computed Column "WptNb":
reportContext.getPersistentGlobalVariable(row["x"])

- in the beforeDrawAxisLabel function, i replace the labels:
var val = label.getCaption().getValue();
//x axis -> replace wptNumbers by waypoints names
var reduce =icsc.getExternalContext().getScriptable().getPersistentGlobalVariable(val+'');
if (reduce != null){
label.getCaption().setValue(reduce);
}


Nevertheless, I have a problem:
Since the persistent variable is set in the onFetch script
reportContext.setPersistentGlobalVariable(row["x"], params["WptNbCurrent1"].value+"");
,
at the same time that computed column is set
reportContext.getPersistentGlobalVariable(row["x"])


the computed column is not correctly computed! each time a new persistent variable is set, the value of the computed column is not set (because the persistent variable does not exist yet...)
how could i do to set a new persistent variable that would be used in the same fetch moment?
Re: Problem with scatter charts [message #904350 is a reply to message #904345] Tue, 28 August 2012 09:45 Go to previous message
ju seb is currently offline ju sebFriend
Messages: 7
Registered: August 2012
Junior Member
Sorry about that, I resolved my problem 2seconds later^^
In the computed column, we have to look if the variable have been initialized,
If not, we have to anticipate setting the next WptNbCurrent1:

if(reportContext.getPersistentGlobalVariable(row["x"]) == null)
params["WptNbCurrent1"].value+1
else params["WptNbCurrent1"].value


Thank you very much for your help!!!! Smile

[Updated on: Tue, 28 August 2012 14:03]

Report message to a moderator

Previous Topic:Getting max date when joining a table to itself
Next Topic:Some queries not working following move to Juno (i.e.BIRT 4.2)
Goto Forum:
  


Current Time: Thu Oct 21 19:31:35 GMT 2021

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

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

Back to the top