Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
JimmyCruyp
Helper II
Helper II

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,

JimCapture d’écran 2023-03-06 101210.png

1 ACCEPTED SOLUTION

I coded the facets to dynamically handle the row/column layout, so adding/removing charts within reason should not be an issue.

giphy

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...
 
width_height_formatting_properties.jpg



Madison Giammaria
Proud to be a Super User 😄
LinkedIn

Do you frequently use Deneb to provide insights to your stakeholders? Have you considered sponsoring this free and open source custom visual? More info here!

View solution in original post

10 REPLIES 10
giammariam
Super User
Super User

Hey @JimmyCruyp. 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).

giammariam_0-1678215202404.png

 

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)

giammariam_1-1678215449851.png

 

You can download a working .pbix here



Madison Giammaria
Proud to be a Super User 😄
LinkedIn

Do you frequently use Deneb to provide insights to your stakeholders? Have you considered sponsoring this free and open source custom visual? More info here!

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....

I coded the facets to dynamically handle the row/column layout, so adding/removing charts within reason should not be an issue.

giphy

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...
 
width_height_formatting_properties.jpg



Madison Giammaria
Proud to be a Super User 😄
LinkedIn

Do you frequently use Deneb to provide insights to your stakeholders? Have you considered sponsoring this free and open source custom visual? More info here!

You are a monster. Thanks a lot. Now I will need the same but for scatter chart. I will create a new post. Thanks superman

giammariam
Super User
Super User

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. 



Madison Giammaria
Proud to be a Super User 😄
LinkedIn

Do you frequently use Deneb to provide insights to your stakeholders? Have you considered sponsoring this free and open source custom visual? More info here!

TypeVoiceResult
APower10
AThen5
AZeld32
ALink8
ANintend2
ASega7
BPower8
BThen4
BZeld6
BLink8
BNintend20
BSega52
CPower9
CThen13
CZeld25
CLink2
CNintend2
CSega3
DPower10
DThen20
DZeld54
DLink10
DNintend30
DSega10
EPower3
EThen65
EZeld9
ELink24
ENintend35
ESega22
FPower70
FThen17
FZeld21
FLink80
FNintend7
FSega10
GPower9
GThen90
GZeld20
GLink20
GNintend100
GSega20
HPower5
HThen5
HZeld120
HLink5
HNintend5
HSega75
IPower33
IThen130
IZeld33
ILink1
INintend0
ISega0
JPower40
JThen11
JZeld22
JLink11
JNintend50
JSega24
KPower3
KThen7
KZeld60
KLink21
KNintend12
KSega22
LPower70
LThen10
LZeld0
LLink10
LNintend20
LSega80
MPower30
MThen22
MZeld25
MLink1
MNintend140
MSega19
NPower22
NThen27
NZeld30
NLink5
NNintend30
NSega6
OPower22
OThen33
OZeld8
OLink9
ONintend38
OSega31

@JimmyCruyp, 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. 

 

Here's the gist

giammariam_0-1678113248968.png

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"}
    ]
  }
}

 



Madison Giammaria
Proud to be a Super User 😄
LinkedIn

Do you frequently use Deneb to provide insights to your stakeholders? Have you considered sponsoring this free and open source custom visual? More info here!

Hi,

Is that possible to have also a bar to set the graphs dimension? As you have done for the multiple treilli? This could be great!!

Jim

Please make a new post and tag me with this request. I'd be happy to.



Madison Giammaria
Proud to be a Super User 😄
LinkedIn

Do you frequently use Deneb to provide insights to your stakeholders? Have you considered sponsoring this free and open source custom visual? More info here!

thanks a lot this looks great. But i dont see anything appearing in Power BI. Maybe because i dont have any configuration? Could you please provide me also the config? Sorry i am very bad at this.

I have added the 3 fields and remoove the url to obtain something starting with this : {
"data": {"name": "dataset"},
"transform":

Could you also please add a percentage in each pie per voice (legend)? fi

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors