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)
Customize series labels in Bubble Chart
vash
Hi,
I am using a bubble chart in my report and I want to customize the series labels.
When I go in "Format Chart" section -> Value (Y) Series -> click "Labels" button -> there are various options to be displayed as Series Labels.
But I want to use of the columns of my dataset as the series labels.
Is there a way to do this?
Plus I want to filter the bubbles based on the bubble size.
Can I do both of this through scripting.
Any suggestions will help.
Thanks,
Vash
Find more posts tagged with
Comments
mwilliams
Hi Vash,
So, you want to label the data points with different labels than one of the fields used in the chart? Also, can you explain more on what you're wanting to do as far as filtering?
vash
Michael,
Yes - I want to label the bubbles with a different field - which is not used in the chart.
On the filtering question:
When I label my bubbles - some of the bubbles are so small that they dont even show up, but the labels do show up. So I want to filter those bubbles - based on the bubble size, something similar to pie chart - when you dont show a pie if its too small.
mwilliams
Vash,
For the filtering problem, I would think you should be able to just set a filter on your chart that filters out the values where the field that you use for the "size" doesn't meet a certain threshhold.
For the replacement of the label, I was able to do this by setting a persistentGlobalVariable with the name of the field I use for my x-axis and a value of the other field from the dataSet I want to use. Then, in the chart, I grab the PGV based on the x-axis value and replace the label value with it.
Let me know if you have questions. If you'd like a quick example, please let me know your BIRT version. Thanks!
vash
Michael,
Thanks for the reply.
I will set the filter on the chart itself - I was looking for something similar to the pie chart - where you can chose not to show the pie based on a minimum value.
It would be great - if you can post a small example.
I am using Birt 2.3.2
Thanks,
Vash
mwilliams
Vash,
For the filter thing, there isn't a feature like the pie chart, unfortunately. You can always request an enhancement for something similar. There may be an option of making computed columns in your dataSet that do the same as the "minimum slice". If the value is smaller than a set limit, you'd make a computed column value to "Other" or something like that, if it met the limit requirement, you'd pass the x-axis field through to the computed column. Then use this column for the x-axis field.
For the label replacement deal, I'll put together a quick example in 2.3.2. I was testing in 2.5.2, so that won't work for you!
vash
Michael,
Thank you for the suggestion on the filtering logic.
I am waiting for the example now.
-Vash
mwilliams
Vash,
Take a look at the script I used to replace the labels. There is script in the onFetch of the dataSet to grab the other value from the dataSet. Then there is script in the chart script that replaces the label. Hope this helps. Let me know.
vash
Michael,
This looks like such a simple solution.
However, I have a problem...
The dataset that is fed into my chart - is a joint dataset - and there is no scripting on the joint data set.
Any work around for that one?
Thanks,
Vash
vash
Micahel,
Plus I have a bigger problem with my dataset values.
I will give you an example of my dataset:
x-axis y-axis size new-field
1 1 3 A
1 2 4 B
2 2 3 C
3 4 5 D
As you see - my x-axis, y-axis - are both numeric values and I want to display a text value as the label. Plus, my dataset does not have unique values for my x or y-axis. So, I dont know how I can map values while creating the PGV.
Vash
mwilliams
Vash,
You do want to change the series labels though, right? Not the x-axis label?
Any way you can set up a sample report that has two CSV or sample database dataSets that you can join together in a similar fashion to what you're doing so I can test with it to find a way? CSV might work better because it would be more similar to your data.
Thanks!
vash
Michael,
I have attached a test csv dataset(attached it as a text file as it wont allow me to attach a csv file) and a test report design.
I want to assign the label column - as my series labels.
Hope this example makes things clear.
Vash
mwilliams
Vash,
This won't meet your complete issue without two dataSources that get joined together, correct? If it will, let me know. If it won't, you might want to make the sample have 2 csv files that are joined in the report to recreate the exact scenario.
vash
Michael,
I will work around on my data representation - to have data come from a single dataset than a joint dataset.
So, you can work on this one.
-Vash
mwilliams
Vash,
Take a look at this report. There is script in the initialize(report), beforeOpen(dataSet), and in the chart.
It sets the label values in a comma separated string, puts that into a PGV, accesses the PGV in a chart, splits it into a string array and accesses the array of labels for each data point in order.
Hope this helps. Let me know if you have questions.
vash
Michael,
I still have questions.
What if I want to sort the data based on some column in the dataset?
And what if one of the 'y' axis value or the size is null? (In this case that entry gets omitted from the chart.)
In both the above cases - the labels logic will break.
Any suggestions/comments?
And if you see it in a broader sense - the ability to add a different column as label - no birt chart has that feature.
So this logic, can be applied to all the different birt charts - and I am surprised how there is no exposure for such a feature.
-Vash
mwilliams
Vash,
You could filter the dataSet that the chart is attached to to rid yourself of the small values rather than on the chart. This would handle that issue. You may be able to create a table that is filtered and sorted the way you want it, create the comma separated string there, use the table as your chart source, and replace the labels in this same fashion.
Another way could be to go back to the all PGV idea and use multiple field values to come up with the PGV name. This way, your chance of running into duplicate names would be greatly reduced or eliminated. For example naming the variable "xAxisValueyAxisValue" or something like that rather than just the xAxis value in my first example.
vash
Michael,
Can you explain a little more on your all PGV solution - to use multiple field values.
Thanks,
Vash
mwilliams
Vash,
In my first example, I set the "name" of the PGV to be the x-axis value and recalled it as such in the chart script. My idea here is that you could set the name of the PGV with the fields you're going to use for the x and y axis and recall the PGV with the base and orthogonal values in the chart.
Let me know if you have questions.
vash
Michael,
I used the logic you mentioned in the last reply - using the x and y axis value.
It works as needed.
Thanks a lot for all the help and the suggestions.
-Vash
mwilliams
Vash,
Not a problem. Glad we were able to find a solution that worked for you!
Kabuco
<p>Hi,</p><p> </p><p>where can I find the example rptdesign files you created and that you are talking about in this thread with Vash, Michael?</p><p> </p><p>Thanks a lot,</p><p>Kabuco</p>
mwilliams
<p>This was a long time ago, but I'm guessing this is the example. It looks like a bunch of posted examples got stripped out on the site upgrade.
</p><p> </p><p> </p>
Kabuco
<p>Hi Michael,</p><p> </p><p>thanks a lot for posting the examples. The earlier version with splitting the string solved my problem.</p><p> </p><p>Best Regards,</p><p>Kabuco</p>
mwilliams
<p>Great! Not a problem. Let us know whenever you have questions!
</p>