Forum Discussion
trelli/multiple scatter plot and pie chart
Hello guys, could we create trelli pie chart? And if not, is that possible to have the code to create this with Deneb module?
I have the same question for multiple Scatter plot .
Thanks a lot,
Jim
I coded the facets to dynamically handle the row/column layout, so adding/removing charts within reason should not be an issue.
Regarding my comment about adjusting those width/height/radius percentage values in deneb, I meant that one would only need to do that if they modify the visual's width and height in the formatting properties (see below screenshot). This is a limitation of faceting in vega-lite; currently the facet cell size cannot dynamically change based on the size of the canvas (yet). I cannot think of a scenario where a user could adjust the visual dimensions but would not have access to being able to update the spec in Deneb...
10 Replies
- giammariamSolution Sage
Hey Jim, this could certainly be done with Deneb. It could also be done with the native matrix and DAX generated SVGs (similar to your correlation matrix post).
The latter would be a bit tougher to pull off, so I'd recommend going with Deneb this time. If you provide some data, I'd be happy to crank out a vega-lite spec.- AnonymousNot applicable
Type Voice Result A Power 10 A Then 5 A Zeld 32 A Link 8 A Nintend 2 A Sega 7 B Power 8 B Then 4 B Zeld 6 B Link 8 B Nintend 20 B Sega 52 C Power 9 C Then 13 C Zeld 25 C Link 2 C Nintend 2 C Sega 3 D Power 10 D Then 20 D Zeld 54 D Link 10 D Nintend 30 D Sega 10 E Power 3 E Then 65 E Zeld 9 E Link 24 E Nintend 35 E Sega 22 F Power 70 F Then 17 F Zeld 21 F Link 80 F Nintend 7 F Sega 10 G Power 9 G Then 90 G Zeld 20 G Link 20 G Nintend 100 G Sega 20 H Power 5 H Then 5 H Zeld 120 H Link 5 H Nintend 5 H Sega 75 I Power 33 I Then 130 I Zeld 33 I Link 1 I Nintend 0 I Sega 0 J Power 40 J Then 11 J Zeld 22 J Link 11 J Nintend 50 J Sega 24 K Power 3 K Then 7 K Zeld 60 K Link 21 K Nintend 12 K Sega 22 L Power 70 L Then 10 L Zeld 0 L Link 10 L Nintend 20 L Sega 80 M Power 30 M Then 22 M Zeld 25 M Link 1 M Nintend 140 M Sega 19 N Power 22 N Then 27 N Zeld 30 N Link 5 N Nintend 30 N Sega 6 O Power 22 O Then 33 O Zeld 8 O Link 9 O Nintend 38 O Sega 31 - giammariamSolution Sage
Anonymous, while I personally don't love pie charts, I do like your choice of dummy data 😀.
There's a lot that can be configured and formatted here, but I kept it simple. Let me know if you need any tweaks.You should be able to copy the spec into Deneb. You'll want to drag in the Type, Voice, and Result fields into the data pane, and remove the url and format properties under the data property in the spec.
If this gets you going, please consider liking this reply and choosing it as the solution so others can find it. If you need additional help, just let me know.spec:
{ "$schema": "https://vega.github.io/schema/vega-lite/v5.json", "data": { "name": "dataset", "url": "https://raw.githubusercontent.com/Giammaria/PublicFiles/master/pbi/pbi_community_help/trellis_pie/data/data.tsv", "format": {"parse": {"Result": "number"}} }, "transform": [ {"joinaggregate": [{"op": "distinct", "field": "Type", "as": "type_count"}]}, {"joinaggregate": [{"op": "sum", "field": "Result", "as": "result_total"}], "groupby": ["Type"]}, {"calculate": "toString(datum['Result'])+' out of '+toString(datum['result_total'])", "as": "result_out_of"}, {"calculate": "format(datum['Result']/datum['result_total'],'.0%')", "as": "percentage"} ], "mark": {"type": "arc"}, "encoding": { "facet": { "field": "Type", "type": "ordinal", "columns": 5, "sort": {"field": "Type"} }, "theta": {"field": "Result", "type": "quantitative"}, "color": {"field": "Voice", "type": "nominal"}, "tooltip": [ {"title": "Voice", "field": "Voice"}, {"title": "Result", "field": "result_out_of"}, {"title": "Result %", "field": "percentage"} ] } }
- giammariamSolution Sage
Hey Anonymous. I implemented some changes and have a version working in Power BI.
You want to make sure that the Summarization for the Result field is set to Don't Summarize (see the below screenshot).
Note - you'll need to play with the radius percentages and the spec width and height based on the size of your visual (see below screenshot)
You can download a working .pbix here
- AnonymousNot applicable
It's awesome. But small question: if the users are not report creators and will not be able or will not have the authorizations to modify the code in Deneb, that means that the graph risks having a bad format? It does not automatically adapt in format according to the number of sector graphs we have? It is very disturbing though....
- giammariamSolution Sage
I coded the facets to dynamically handle the row/column layout, so adding/removing charts within reason should not be an issue.
Regarding my comment about adjusting those width/height/radius percentage values in deneb, I meant that one would only need to do that if they modify the visual's width and height in the formatting properties (see below screenshot). This is a limitation of faceting in vega-lite; currently the facet cell size cannot dynamically change based on the size of the canvas (yet). I cannot think of a scenario where a user could adjust the visual dimensions but would not have access to being able to update the spec in Deneb...