Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
To represent chart by Java script. (ASAP)
shi
<span style='font-family: Tahoma'>Hello, <br />
<br />
I'm using BIRT 2.3.2. and we're going to use BIRT 11.<br />
Now we are examining the way to apply the below case using Java Script.<br />
It's very important matter for us.<br />
Of course, it isn't most important thing using Java Script.<br />
<br />
There are 8 points in all.<br />
<br />
To change the first label of axis to the another one as the below chart. <br />
<br />
To show the axis labels vertically [from top to bottom] like below chart.<br />
<br />
To insert a ruled line crossing over the axis on the chart, like below chart.<br />
<br />
800 | 7.0 <br />
700 | * 6.0<br />
600 | 5.0 * * 5.0<br />
500 | * * * * 4.0<br />
400 | * * 3.0 3.0 * * * <br />
300 | * * * * * * * <br />
<br />
200 | * * * * * * * <br />
100 | * * * * * * * <br />
<br />
S 5 10 15 20 25 30 <br />
T<br />
A<br />
R<br />
T<br />
<br />
<br />
To show axis labels in fixed 2 rows.<br />
<br />
To change the order of legend.<br />
To change only Icon of legend. ( "* VWX" -> "- VMX" )<br />
<br />
<br />
| - ABC - DEF |<br />
| - GHI - JKL |<br />
| - MNO - PQR |<br />
| - STU * VWX |<br />
<br />
<br />
| - ABC - JKL |<br />
=> | - MNO - PQR |<br />
| - STU - DEF |<br />
| - GHI - VWX |<br />
<br />
<br />
<br />
To change the line at the specified letter of the axis characters(letters) like below chart.<br />
<br />
To put the legend crossing over the axis on the chart like below chart.<br />
<br />
800 | 7.0 <br />
700 | * 6.0<br />
600 | 5.0 * * 5.0<br />
* * 4.0<br />
| - aaa | 3.0 3.0 * * * <br />
| - bbb | * * * * * <br />
* * * * * <br />
100 | * * * * * * * <br />
<br />
A B C D E F G<br />
(a) bbb (f)<br />
<br />
<br />
Any help would be appreciated.<br />
<br />
Thanks,<br />
Shino</span>
Find more posts tagged with
Comments
mwilliams
Hi Shino,
I'm not sure I'm understanding everything you've asked. Is there any way you can descibe these more? Images of charts would help greatly too.
1 - Changing the label to another. Are you asking about substituting a value for the first label? Or reordering the labels so that a different one is first?
2 - You can format the axis label to vertical using the chart editor. Are you specifically wanting to do this with script?
3 - You want a marker line that will cross over the y-axis to separate values?
4 - Do you have very long labels that need 2 lines?
5 - The legend is ordered in the order of your chart.
6 - What do you mean by chaning the "icon" of the legend? The color block? Or the legend label?
7 - Not sure I understand this one at all.
8 - Not sure I understand this one either.
Let me know. Thanks!
shi
Hello, Michael
Thank you for your reply immediately.
1 - Changing the label to another. Are you asking about substituting a value for the first label? Or reordering the labels so that a different one is first?
==>I'm asking about substituting a value for the first label.
2 - You can format the axis label to vertical using the chart editor. Are you specifically wanting to do this with script?
==>I know use the cart editor. However, If it's specified, using that function, Each character is arranged in transverse. Please see attached file.
3 - You want a marker line that will cross over the y-axis to separate values?
==>Yes
4 - Do you have very long labels that need 2 lines?
==>There are many labels. So I need to put the 2 items per a line. Please see attached file.
5 - The legend is ordered in the order of your chart.
==>Could not I change that order..?
6 - What do you mean by chaning the "icon" of the legend? The color block? Or the legend label?
==>Please see the attached file.
7 - Not sure I understand this one at all.
==>Please see the attached file.
8 - Not sure I understand this one either.
==>Please see the attached file.
Thank you for your help, and best regards,
Shino
mwilliams
Shino,<br />
<br />
1 - Something like this should work:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
i=0;
function beforeDrawAxisLabel( axis, label, icsc )
{
if (axis.isCategoryAxis()){
if (i == 0){
label.getCaption().setValue("newValue");
i = 1;
}
}
}
</pre>
<br />
2 - You can control the label rotation in the same function with:<br />
<br />
label.getCaption().getFont().setRotation(-45.0);<br />
<br />
3 - I don't know if you'll be able to do this or not. I haven't found a way for a marker line to cross the y-axis yet.<br />
<br />
I'll look at the file and work on 4+ and report back.
shi
Hello Michael,
Thank you for your great help.
I'm expecting your reply.
Thanks & regards,
Shino
mwilliams
Shino,
For 4, I don't see a way to specify a width or wrapping of text for a label. This is something you'd probably have to request as an enhancement.
http://www.birt-exchange.org/org/resources/bug-reporting/
For 5, You could probably custom order your legend through script if you used custom colors for all of your chart series' and then you could change the values of the legend labels and colors of the blocks associated with them to fit the order that you want them displayed in.
For 6, The icon is decided by chart type. I'm guessing that this won't be easily changed. This could be another enhancement request, to allow the report developer to decide whether to have a standard icon or a chart type specific icon.
For 7, This seems much like 4. Not sure that there's going to be a way to specify this.
For 8, You can change the position of the legend to inside, anchor it to the left, and change the left inset value to a negative number. That should allow it to sit over the y-axis.
Hope this helps.
shi
Hi Michael,
Thank you for your great help.
I'm going to talk about these topics.
Thank you again.
Shino
mwilliams
Not a problem. Let us know whenever you have questions!
shi
Hello Michael,
There are additional questions.
(1)
It needs to change the font size of the specified series's labels.
Would you teach us how we should do for this matter.
(2)
About "2", we tried that script(..setRotation(-45.0)) as your instruction, however, that result was not same as our expectation.
We tried the other scripts that modified your instruction, but we could not find any method to solve this matter.
Please help us.
Thanks,
mwilliams
For #1, you need to do this in script? You can't just set this in the chart editor?
For #2, how was the result from the script I gave you different than your expectations?
shi
Hello Michael,
Please see the attached file.
Sorry to bother you again.
Thank you,
Shino
mwilliams
Shino,<br />
<br />
The closest I think you'll get on #2 is to change the -45 into -90. You can always request an enhancement for something like what it looks like you're wanting.<br />
<br />
<a class='bbc_url' href='
http://www.birt-exchange.org/org/resources/bug-reporting/'>http://www.birt-exchange.org/org/resources/bug-reporting/</a><br
/>
<br />
For #1:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
function beforeDrawDataPointLabel( dph, label, icsc )
{
if (dph.getOrthogonalValue() > .60){
label.getCaption().getFont().setSize(16);
}
}
</pre>
<br />
Hope this helps. Let me know if you'd like it in an example.
shi
Michael,
I told about this topic.
We are going to request enhancement about #2.
Thank you very much for your help.
Regards,
Shino
mwilliams
Not a problem. As always, let us know whenever you have questions!