chriss_1985 Posted November 1, 2016 Share Posted November 1, 2016 Hello Community,I would like to create a pie chart (HTML5) within Jaspersoft Studio (6.1.0).My data source is following table:COLOR | NUMBER | NUMBER_STRING-------------------------------Green | 3 | '3'Yellow | 7 | '7'Red | 5 | '5'Grey | 4 | '4'My pie chart should contain four sections:- A green section (Size: 3/19 of the circle; Label in the section: '3')- A yellow section (Size: 7/19 of the circle; Label in the section: '7')- A red section (Size: 5/19 of the circle; Label in the section: '5')- A grey section (Size: 4/19 of the circle; Label in the section: '4')Problem: The labels don't show values from the attribute NUMBER.Some of my pie chart settings:> Chart Data -> Configuration -> Categories Levels:- Expression: $F{COLOR}> Chart Data -> Configuration -> Value:- Label Expression: $F{NUMBER_STRING}- Value Expression: $F{NUMBER}> Chart Properties -> Colors Palette:- "Green, Yellow, Red, Grey"Result: Everything works. I get four pies in right size and color. But for the labels I get the values from the attribute COLOR. Not from the attribute NUMBER (or NUMBER_STRING).Thanks for your help.Chris Link to comment Share on other sites More sharing options...
lucianc Posted November 2, 2016 Share Posted November 2, 2016 The Chart Data/Configuration/Value/Label Expression is somewhat misleading, it's actually a label for the measure/series itself (like "Sales Amount" or "Number of items").If you want to specify a label for each point/item in the series, you'll have to do the following:In the category level, add a Bucket Property called NumberString, using $F{NUMBER_STRING} as expression.In Value/Advanced properties, add a property with SeriesItemProperty as Contributor, label as Property Name and Level1.NumberString as Bucket Value.In Chart properties, add a property called plotOptions.pie.dataLabels.format using {point.label} as value.Attaching a JRXML with the solution described above.Regards,Lucian Link to comment Share on other sites More sharing options...
ivan.lorenzo Posted December 2, 2019 Share Posted December 2, 2019 lucianc, thanks a lot!!Great, great answer indeed! It help me a lot.Regards! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now