Home » Archived » BIRT » Dynamically Altering Chart's Grouping - Round 2
Dynamically Altering Chart's Grouping - Round 2 [message #257253] |
Fri, 05 October 2007 02:33  |
Eclipse User |
|
|
|
Originally posted by: clf.clf.com
Hello,
Can anybody tell me why this doesn't work?
function beforeGeneration(chart, icsc)
{
chart.getPrimaryBaseAxes()[0].getSeriesDefinitions().get(0). getGrouping().setEnabled(false);}This is script embedded in the report. This does not error, but it alsodoes not turn my grouping off. It seems no matter what modifications I doto the grouping here, it does not take effect. It's almost as if thesettings from the GUI are applied *after* this code is executed (in otherwords, maybe my changes get overwritten by the settings done in the GUI).There doesn't seem to be any other events where I can do this.Any ideas?Thanks!
|
|
|
Re: Dynamically Altering Chart's Grouping - Round 2 - PLEASE LOOK INTO THIS JASON [message #257258 is a reply to message #257253] |
Fri, 05 October 2007 03:09   |
Eclipse User |
|
|
|
Clf/Jason,
I am encountering the same problem. I am trying to modify my grouping
interval and unit on the base axis dynamically through the beforeGeneration
method and it doesn't get modified.
I logged the values of my interval and unit before and after modification in
the same method and it shows the correct values. I even tried logging the
modified values from beforeRendering and that is correct too.
function beforeGeneration(chart, icsc)
{
importPackage(Packages.org.eclipse.birt.chart.model.attribut e);
//logged values of interval and unit from here - shows what I set through
the gui beforehand
chart.getPrimaryBaseAxes()[0].getSeriesDefinitions().get(0). getGrouping().setGroupingInterval(30);
chart.getPrimaryBaseAxes()[0].getSeriesDefinitions().get(0). getGrouping().setGroupingUnit(GroupingUnitType.DAYS_LITERAL) ;
//logged values of interval and unit-- shows the correct modified values
}
function beforeRendering(gcs, icsc)
{ //logged values of interval and unit from here -- shows correct modified
valuees
}
Looks like the setting in the GUI does override what I set.
Jason, is this a bug? If yes its a major hindrance to our progress. Could
you suggest a workaround?
Thanks,
PC
"clf" <clf@clf.com> wrote in message news:fe4lsc$a1v$1@build.eclipse.org...
> Hello,
> Can anybody tell me why this doesn't work?
>
> function beforeGeneration(chart, icsc)
> {
> chart.getPrimaryBaseAxes()[0].getSeriesDefinitions().get(0). getGrouping().setEnabled(false);}This
> is script embedded in the report. This does not error, but it alsodoes
> not turn my grouping off. It seems no matter what modifications I doto
> the grouping here, it does not take effect. It's almost as if thesettings
> from the GUI are applied *after* this code is executed (in otherwords,
> maybe my changes get overwritten by the settings done in the GUI).There
> doesn't seem to be any other events where I can do this.Any ideas?Thanks!
>
|
|
|
Re: Dynamically Altering Chart's Grouping - Round 2 [message #257266 is a reply to message #257258] |
Fri, 05 October 2007 03:22   |
Eclipse User |
|
|
|
Originally posted by: clf.clf.com
Hi,
Shortly after I posted the message, I did find a workaround, but I don't
know if it's an option for you. It does work if you use a Java event
handler (extending ReportEventAdapter) instead. So in otherwords,
overriding the same method, and doing the same thing we were trying in
Javascript... only in Java.
The only problem I'm finding with this is that I can no longer preview the
report, I get a ClassNotFound error.... report only works at runtime in my
app server, which is a big pain.
Anyway, that's a possible workaround for you... but I'd still like to have
the option to script this stuff if we can figure that out. I'm guessing
it's a bug. I'll probably add to bugzilla tomorrow.
"chakravp" <chakravp@us.ibm.com> wrote in message
news:fe4nou$knl$1@build.eclipse.org...
> Clf/Jason,
>
> I am encountering the same problem. I am trying to modify my grouping
> interval and unit on the base axis dynamically through the
> beforeGeneration method and it doesn't get modified.
> I logged the values of my interval and unit before and after modification
> in the same method and it shows the correct values. I even tried logging
> the modified values from beforeRendering and that is correct too.
> function beforeGeneration(chart, icsc)
>
> {
>
> importPackage(Packages.org.eclipse.birt.chart.model.attribut e);
>
> //logged values of interval and unit from here - shows what I set through
> the gui beforehand
>
>
>
> chart.getPrimaryBaseAxes()[0].getSeriesDefinitions().get(0). getGrouping().setGroupingInterval(30);
>
> chart.getPrimaryBaseAxes()[0].getSeriesDefinitions().get(0). getGrouping().setGroupingUnit(GroupingUnitType.DAYS_LITERAL) ;
>
> //logged values of interval and unit-- shows the correct modified values
>
>
>
>
> }
>
> function beforeRendering(gcs, icsc)
>
> { //logged values of interval and unit from here -- shows correct modified
> valuees
>
> }
>
> Looks like the setting in the GUI does override what I set.
>
> Jason, is this a bug? If yes its a major hindrance to our progress. Could
> you suggest a workaround?
>
>
>
> Thanks,
>
> PC
|
|
| |
Re: Dynamically Altering Chart's Grouping - Round 2 - PLEASE LOOK INTO THIS JASON [message #257290 is a reply to message #257258] |
Fri, 05 October 2007 03:42   |
Eclipse User |
|
|
|
Some further investigation on this issue:
I disbaled grouping from the GUI and then enabled it from the
beforeGeneration method.
Surprisingly even though grouping is disabled, when I log the values for
isSetEnabled, grouping interval and unit before I make any modifications, it
shows up as enabled = true, interval= 1 ,unit = Hours--- that is the value
that was present before I disabled grouping through the GUI.
I created a fresh chart and tried the same thing. It shows enabled = true;
interval = 2; unit = Seconds. 2 seconds is the default grouping specified
by birt.
I logged the modified values in afterRender method also and they are
correctly modified.
-PC
"chakravp" <chakravp@us.ibm.com> wrote in message
news:fe4nou$knl$1@build.eclipse.org...
> Clf/Jason,
>
> I am encountering the same problem. I am trying to modify my grouping
> interval and unit on the base axis dynamically through the
> beforeGeneration method and it doesn't get modified.
> I logged the values of my interval and unit before and after modification
> in the same method and it shows the correct values. I even tried logging
> the modified values from beforeRendering and that is correct too.
> function beforeGeneration(chart, icsc)
>
> {
>
> importPackage(Packages.org.eclipse.birt.chart.model.attribut e);
>
> //logged values of interval and unit from here - shows what I set through
> the gui beforehand
>
>
>
> chart.getPrimaryBaseAxes()[0].getSeriesDefinitions().get(0). getGrouping().setGroupingInterval(30);
>
> chart.getPrimaryBaseAxes()[0].getSeriesDefinitions().get(0). getGrouping().setGroupingUnit(GroupingUnitType.DAYS_LITERAL) ;
>
> //logged values of interval and unit-- shows the correct modified values
>
>
>
>
> }
>
> function beforeRendering(gcs, icsc)
>
> { //logged values of interval and unit from here -- shows correct modified
> valuees
>
> }
>
> Looks like the setting in the GUI does override what I set.
>
> Jason, is this a bug? If yes its a major hindrance to our progress. Could
> you suggest a workaround?
>
>
>
> Thanks,
>
> PC
>
>
>
> "clf" <clf@clf.com> wrote in message
> news:fe4lsc$a1v$1@build.eclipse.org...
>> Hello,
>> Can anybody tell me why this doesn't work?
>>
>> function beforeGeneration(chart, icsc)
>> {
>> chart.getPrimaryBaseAxes()[0].getSeriesDefinitions().get(0). getGrouping().setEnabled(false);}This
>> is script embedded in the report. This does not error, but it alsodoes
>> not turn my grouping off. It seems no matter what modifications I doto
>> the grouping here, it does not take effect. It's almost as if
>> thesettings from the GUI are applied *after* this code is executed (in
>> otherwords, maybe my changes get overwritten by the settings done in the
>> GUI).There doesn't seem to be any other events where I can do this.Any
>> ideas?Thanks!
>>
>
>
|
|
|
Re: Dynamically Altering Chart's Grouping - Round 2 [message #257294 is a reply to message #257278] |
Fri, 05 October 2007 03:53   |
Eclipse User |
|
|
|
Thanks for your suggestion, Clf. But in my case I can't use Java event
handler :(
Definitely looks like a bug. Could you post the bug number once you have
opened it? I would like to track it.
Thanks,
PC
"clf" <clf@clf.com> wrote in message news:fe4ove$b9h$1@build.eclipse.org...
> Correction... I'm not overriding the same method in Java. I'm actually
> changing the grouping settings in beforeFactory of ReportEventAdapter.
>
>
> "clf" <clf@clf.com> wrote in message
> news:fe4oms$9rn$1@build.eclipse.org...
>> Hi,
>> Shortly after I posted the message, I did find a workaround, but I don't
>> know if it's an option for you. It does work if you use a Java event
>> handler (extending ReportEventAdapter) instead. So in otherwords,
>> overriding the same method, and doing the same thing we were trying in
>> Javascript... only in Java.
>>
>> The only problem I'm finding with this is that I can no longer preview
>> the report, I get a ClassNotFound error.... report only works at runtime
>> in my app server, which is a big pain.
>>
>> Anyway, that's a possible workaround for you... but I'd still like to
>> have the option to script this stuff if we can figure that out. I'm
>> guessing it's a bug. I'll probably add to bugzilla tomorrow.
>>
>
>
>
>
|
|
| |
Re: Dynamically Altering Chart's Grouping - Round 2 [message #257342 is a reply to message #257298] |
Fri, 05 October 2007 13:25   |
Eclipse User |
|
|
|
Hi David,
Thanks for the pointer.
I am able to call methods from the Chart interface like getPlot, getLegend
etc
But how do I get the axes of the chart?
This is the code I have in the beforeFactory
var chart = this.getReportElement("Chart1");
chart.getPrimaryBaseAxes()[0].getSeriesDefinitions().get(0). getGrouping().setGroupingInterval(30);
getPrimaryBaseAxes is not recognized as a method.
I tried typecasting the chart to ChartWithAxes and then trying that code.
That does not work either since I am not sure
how Rhino handles typecasting of java objects from within the javascript.
Any pointers on this would really help.
Thanks,
PC
"David Michonneau" <dmichonneau@actuate.com> wrote in message
news:fe4rg3$vkh$1@build.eclipse.org...
> Hi,
>
> Any script on the chart will be executed after the data has been bound to
> it. So changing the grouping model at that time will change the model
> effectively, but not the way the data is bound to it.
>
> You want to instead modify the grouping of the chart in the beforeFactory
> method of the report. See some explanations and examples here:
>
> http://wiki.eclipse.org/Calling_the_Simple_Chart_API_from_Sc ript(BIRT)
>
> Thanks,
>
> David
>
> "clf" <clf@clf.com> wrote in message
> news:fe4lsc$a1v$1@build.eclipse.org...
>> Hello,
>> Can anybody tell me why this doesn't work?
>>
>> function beforeGeneration(chart, icsc)
>> {
>> chart.getPrimaryBaseAxes()[0].getSeriesDefinitions().get(0). getGrouping().setEnabled(false);}This
>> is script embedded in the report. This does not error, but it alsodoes
>> not turn my grouping off. It seems no matter what modifications I doto
>> the grouping here, it does not take effect. It's almost as if
>> thesettings from the GUI are applied *after* this code is executed (in
>> otherwords, maybe my changes get overwritten by the settings done in the
>> GUI).There doesn't seem to be any other events where I can do this.Any
>> ideas?Thanks!
>>
>
>
|
|
|
Re: Dynamically Altering Chart's Grouping - Round 2 [message #257353 is a reply to message #257342] |
Fri, 05 October 2007 16:34   |
Eclipse User |
|
|
|
Hi,
I was referring to the old API javadoc and hence was not getthing this
right. I was able to get this working from beforeFactory using the IChart
API docs
http://www.eclipse.org/birt/release20specs/BPS66/BPS%2066%20 -%20Chart%20Simple%20API%20SPEC.pdf
var chart = this.getReportElement("Chart1");
chart.getCategory().getGrouping().setGroupInterval(interval) ;
-PC
"chakravp" <chakravp@us.ibm.com> wrote in message
news:fe5rrl$f1g$1@build.eclipse.org...
> Hi David,
>
> Thanks for the pointer.
> I am able to call methods from the Chart interface like getPlot, getLegend
> etc
> But how do I get the axes of the chart?
>
> This is the code I have in the beforeFactory
> var chart = this.getReportElement("Chart1");
> chart.getPrimaryBaseAxes()[0].getSeriesDefinitions().get(0). getGrouping().setGroupingInterval(30);
>
> getPrimaryBaseAxes is not recognized as a method.
> I tried typecasting the chart to ChartWithAxes and then trying that code.
> That does not work either since I am not sure
> how Rhino handles typecasting of java objects from within the javascript.
>
> Any pointers on this would really help.
>
> Thanks,
> PC
>
>
>
>
> "David Michonneau" <dmichonneau@actuate.com> wrote in message
> news:fe4rg3$vkh$1@build.eclipse.org...
>> Hi,
>>
>> Any script on the chart will be executed after the data has been bound to
>> it. So changing the grouping model at that time will change the model
>> effectively, but not the way the data is bound to it.
>>
>> You want to instead modify the grouping of the chart in the beforeFactory
>> method of the report. See some explanations and examples here:
>>
>> http://wiki.eclipse.org/Calling_the_Simple_Chart_API_from_Sc ript(BIRT)
>>
>> Thanks,
>>
>> David
>>
>> "clf" <clf@clf.com> wrote in message
>> news:fe4lsc$a1v$1@build.eclipse.org...
>>> Hello,
>>> Can anybody tell me why this doesn't work?
>>>
>>> function beforeGeneration(chart, icsc)
>>> {
>>> chart.getPrimaryBaseAxes()[0].getSeriesDefinitions().get(0). getGrouping().setEnabled(false);}This
>>> is script embedded in the report. This does not error, but it alsodoes
>>> not turn my grouping off. It seems no matter what modifications I doto
>>> the grouping here, it does not take effect. It's almost as if
>>> thesettings from the GUI are applied *after* this code is executed (in
>>> otherwords, maybe my changes get overwritten by the settings done in the
>>> GUI).There doesn't seem to be any other events where I can do this.Any
>>> ideas?Thanks!
>>>
>>
>>
>
>
|
|
|
Re: Dynamically Altering Chart's Grouping - Round 2 [message #257404 is a reply to message #257353] |
Sat, 06 October 2007 03:41  |
Eclipse User |
|
|
|
Yes, this is the simple chart API which is more similar to remaining of the
DE script API than the internal chart model, which is quite complex.
Thanksm,
David
"chakravp" <chakravp@us.ibm.com> wrote in message
news:fe66v5$4mc$1@build.eclipse.org...
> Hi,
>
> I was referring to the old API javadoc and hence was not getthing this
> right. I was able to get this working from beforeFactory using the IChart
> API docs
> http://www.eclipse.org/birt/release20specs/BPS66/BPS%2066%20 -%20Chart%20Simple%20API%20SPEC.pdf
>
> var chart = this.getReportElement("Chart1");
>
> chart.getCategory().getGrouping().setGroupInterval(interval) ;
>
> -PC
>
> "chakravp" <chakravp@us.ibm.com> wrote in message
> news:fe5rrl$f1g$1@build.eclipse.org...
>> Hi David,
>>
>> Thanks for the pointer.
>> I am able to call methods from the Chart interface like getPlot,
>> getLegend etc
>> But how do I get the axes of the chart?
>>
>> This is the code I have in the beforeFactory
>> var chart = this.getReportElement("Chart1");
>> chart.getPrimaryBaseAxes()[0].getSeriesDefinitions().get(0). getGrouping().setGroupingInterval(30);
>>
>> getPrimaryBaseAxes is not recognized as a method.
>> I tried typecasting the chart to ChartWithAxes and then trying that code.
>> That does not work either since I am not sure
>> how Rhino handles typecasting of java objects from within the javascript.
>>
>> Any pointers on this would really help.
>>
>> Thanks,
>> PC
>>
>>
>>
>>
>> "David Michonneau" <dmichonneau@actuate.com> wrote in message
>> news:fe4rg3$vkh$1@build.eclipse.org...
>>> Hi,
>>>
>>> Any script on the chart will be executed after the data has been bound
>>> to it. So changing the grouping model at that time will change the model
>>> effectively, but not the way the data is bound to it.
>>>
>>> You want to instead modify the grouping of the chart in the
>>> beforeFactory method of the report. See some explanations and examples
>>> here:
>>>
>>> http://wiki.eclipse.org/Calling_the_Simple_Chart_API_from_Sc ript(BIRT)
>>>
>>> Thanks,
>>>
>>> David
>>>
>>> "clf" <clf@clf.com> wrote in message
>>> news:fe4lsc$a1v$1@build.eclipse.org...
>>>> Hello,
>>>> Can anybody tell me why this doesn't work?
>>>>
>>>> function beforeGeneration(chart, icsc)
>>>> {
>>>> chart.getPrimaryBaseAxes()[0].getSeriesDefinitions().get(0). getGrouping().setEnabled(false);}This
>>>> is script embedded in the report. This does not error, but it alsodoes
>>>> not turn my grouping off. It seems no matter what modifications I doto
>>>> the grouping here, it does not take effect. It's almost as if
>>>> thesettings from the GUI are applied *after* this code is executed (in
>>>> otherwords, maybe my changes get overwritten by the settings done in
>>>> the GUI).There doesn't seem to be any other events where I can do
>>>> this.Any ideas?Thanks!
>>>>
>>>
>>>
>>
>>
>
>
|
|
|
Goto Forum:
Current Time: Wed Jul 16 03:29:19 EDT 2025
Powered by FUDForum. Page generated in 0.30601 seconds
|