<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Double box plot in Custom Visuals Development Discussion</title>
    <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Double-box-plot/m-p/3161071#M7226</link>
    <description>&lt;P&gt;Hello Giammaria, sorry for appealing to you... I know that you are not the author of the graph, but the creator of the graph specified that he did not have more time to grant this. I thought that this new visualization might interest you and that you could possibly bring it to you. Especially because I can't use it. It may be more standard yielding but also adding a possibility to enlarge or reduce the box plot. Can you help me on this? This visual is very important to me... I thanked in advance,&lt;/P&gt;</description>
    <pubDate>Wed, 29 Mar 2023 13:59:04 GMT</pubDate>
    <dc:creator>JimmyCruyp</dc:creator>
    <dc:date>2023-03-29T13:59:04Z</dc:date>
    <item>
      <title>Double box plot</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Double-box-plot/m-p/3083687#M6891</link>
      <description>&lt;P&gt;Hello, I am trying to find a graph or a solution to have a double box plot. See picture. Anyone?&lt;/P&gt;&lt;P&gt;Thanks a lot,&lt;/P&gt;&lt;P&gt;Jim&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture d’écran 2023-02-16 172923.png" style="width: 187px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/873068i6FFB68B6BA23BD44/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture d’écran 2023-02-16 172923.png" alt="Capture d’écran 2023-02-16 172923.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2023 16:29:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Double-box-plot/m-p/3083687#M6891</guid>
      <dc:creator>JimmyCruyp</dc:creator>
      <dc:date>2023-02-16T16:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: Double box plot</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Double-box-plot/m-p/3091404#M6925</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/516108"&gt;@JimmyCruyp&lt;/a&gt;,&amp;nbsp;and thanks for such an interesting question! I'm not aware of anything, so I have had a go at building using &lt;A href="https://deneb-viz.github.io/" target="_self"&gt;Deneb&lt;/A&gt; with &lt;A href="https://vega.github.io/vega-lite" target="_self"&gt;Vega-Lite&lt;/A&gt; and the iris dataset, which I hope proves the concept:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dmp_0-1677015649384.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/875500i8F3E0082416BA0B8/image-size/large?v=v2&amp;amp;px=999" role="button" title="dmp_0-1677015649384.png" alt="dmp_0-1677015649384.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;While Vega-Lite has a boxplot mark for standard box plots, I needed to calculate the statistics and draw this from primitive marks, so the specification is quite long. I've attached a workbook showing this in action, and I'll list the JSON specification lower down.&lt;/P&gt;
&lt;P&gt;Note that because Power BI aggregates measures, you will need to use an index row to ensure that you get all rows in your dataset as intended. In the workbook, this is the&amp;nbsp;&lt;EM&gt;Row Number&lt;/EM&gt; field, and is a sequential field.&lt;/P&gt;
&lt;P&gt;If you're not familiar with this concept, &lt;A style="background-color: #ffffff;" href="https://coacervo.co/violin-plot-sampling" target="_self"&gt;I have a blog post here about it&lt;/A&gt;, which may help.&lt;/P&gt;
&lt;P&gt;Note that this solution is provided as-is, as it took me a few hours to work out, so don't have any time available for further support. If you want to tweak this design, then it's best to have a look at the &lt;A href="https://vega.github.io/vega-lite/docs/" target="_self"&gt;Vega-Lite documentation&lt;/A&gt; to see how the language works. Because Deneb visuals are certified you get many of the advantages you don't get with R and Python visuals, such as full compatibility with publish to web, and PowerPoint &amp;amp; PDF exports.&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;JSON Specification (as per workbook):&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;{
  "data": {"name": "dataset"},
  "transform": [
    {
      "joinaggregate": [
        {
          "op": "count",
          "field": "Row Number",
          "as": "count"
        },
        {
          "op": "q1",
          "field": "Sepal Length",
          "as": "x_q1"
        },
        {
          "op": "q3",
          "field": "Sepal Length",
          "as": "x_q3"
        },
        {
          "op": "median",
          "field": "Sepal Length",
          "as": "x_median"
        },
        {
          "op": "min",
          "field": "Sepal Length",
          "as": "x_min"
        },
        {
          "op": "max",
          "field": "Sepal Length",
          "as": "x_max"
        },
        {
          "op": "q1",
          "field": "Sepal Width",
          "as": "y_q1"
        },
        {
          "op": "q3",
          "field": "Sepal Width",
          "as": "y_q3"
        },
        {
          "op": "median",
          "field": "Sepal Width",
          "as": "y_median"
        },
        {
          "op": "min",
          "field": "Sepal Width",
          "as": "y_min"
        },
        {
          "op": "max",
          "field": "Sepal Width",
          "as": "y_max"
        }
      ],
      "groupby": ["Species"]
    },
    {
      "calculate": "datum['x_q3'] - datum['x_q1']",
      "as": "x_iqr"
    },
    {
      "calculate": "datum['y_q3'] - datum['y_q1']",
      "as": "y_iqr"
    },
    {
      "calculate": "datum['x_q1'] - 1.5 * datum['x_iqr']",
      "as": "x_lower"
    },
    {
      "calculate": "datum['x_q3'] + 1.5 * datum['x_iqr']",
      "as": "x_upper"
    },
    {
      "calculate": "datum['y_q1'] - 1.5 * datum['y_iqr']",
      "as": "y_lower"
    },
    {
      "calculate": "datum['y_q3'] + 1.5 * datum['y_iqr']",
      "as": "y_upper"
    },
    {
      "calculate": "datum['Sepal Length'] &amp;lt; datum['x_lower'] || datum['Sepal Length'] &amp;gt; datum['x_upper']",
      "as": "x_outlier"
    },
    {
      "calculate": "datum['Sepal Width'] &amp;lt; datum['y_lower'] || datum['Sepal Width'] &amp;gt; datum['y_upper']",
      "as": "y_outlier"
    },
    {
      "calculate": "'x=' + pbiFormat(datum['x_min'], '#0.0') + ', y=' + pbiFormat(datum['y_min'], '#0.0')",
      "as": "tooltip_min"
    },
    {
      "calculate": "'x=' + pbiFormat(datum['x_q1'], '#0.0') + ', y=' + pbiFormat(datum['y_q1'], '#0.0')",
      "as": "tooltip_q1"
    },
    {
      "calculate": "'x=' + pbiFormat(datum['x_median'], '#0.0') + ', y=' + pbiFormat(datum['y_median'], '#0.0')",
      "as": "tooltip_median"
    },
    {
      "calculate": "'x=' + pbiFormat(datum['x_q3'], '#0.0') + ', y=' + pbiFormat(datum['y_q3'], '#0.0')",
      "as": "tooltip_q3"
    },
    {
      "calculate": "'x=' + pbiFormat(datum['x_max'], '#0.0') + ', y=' + pbiFormat(datum['y_max'], '#0.0')",
      "as": "tooltip_max"
    }
  ],
  "layer": [
    {
      "description": "Box plot portion; aggregate our data so that we only get the right number of marks per category.",
      "transform": [
        {
          "aggregate": [],
          "groupby": [
            "Species",
            "count",
            "x_min",
            "x_lower",
            "x_q1",
            "x_median",
            "x_q3",
            "x_upper",
            "x_max",
            "y_min",
            "y_lower",
            "y_q1",
            "y_median",
            "y_q3",
            "y_upper",
            "y_max",
            "tooltip_min",
            "tooltip_q1",
            "tooltip_median",
            "tooltip_q3",
            "tooltip_max"
          ]
        }
      ],
      "layer": [
        {
          "description": "Box (drawn with a rectangle and the x/y quartiles.",
          "mark": {
            "type": "rect",
            "tooltip": true,
            "fillOpacity": 0.5
          },
          "encoding": {
            "x": {"field": "x_q1"},
            "x2": {"field": "x_q3"},
            "y": {"field": "y_q1"},
            "y2": {"field": "y_q3"},
            "stroke": {
              "field": "Species",
              "legend": null
            }
          }
        },
        {
          "description": "x whisker (runs from x lower to x upper and positioned vertically by y median).",
          "mark": {"type": "rule"},
          "encoding": {
            "x": {"field": "x_lower"},
            "x2": {"field": "x_upper"},
            "y": {"field": "y_median"}
          }
        },
        {
          "description": "x lower and upper rules",
          "encoding": {
            "y": {"field": "y_q3"},
            "y2": {"field": "y_q1"}
          },
          "layer": [
            {
              "description": "x lower value",
              "mark": {"type": "rule"},
              "encoding": {
                "x": {
                  "field": "x_lower"
                }
              }
            },
            {
              "description": "x upper value",
              "mark": {"type": "rule"},
              "encoding": {
                "x": {
                  "field": "x_upper"
                }
              }
            }
          ]
        },
        {
          "description": "y whisker (runs from y lower to y upper and positioned vertically by x median).",
          "mark": {"type": "rule"},
          "encoding": {
            "y": {"field": "y_lower"},
            "y2": {"field": "y_upper"},
            "x": {"field": "x_median"}
          }
        },
        {
          "description": "y lower and upper rules",
          "encoding": {
            "x": {"field": "x_q3"},
            "x2": {"field": "x_q1"}
          },
          "layer": [
            {
              "description": "y lower value",
              "mark": {"type": "rule"},
              "encoding": {
                "y": {
                  "field": "y_lower"
                }
              }
            },
            {
              "description": "y upper value",
              "mark": {"type": "rule"},
              "encoding": {
                "y": {
                  "field": "y_upper"
                }
              }
            }
          ]
        }
      ]
    },
    {
      "description": "outlier values.",
      "encoding": {
        "tooltip": [
          {"field": "Species"},
          {"field": "Sepal Width"},
          {"field": "Sepal Length"}
        ]
      },
      "layer": [
        {
          "description": "x outlier values.",
          "transform": [
            {
              "filter": "datum['x_outlier']"
            }
          ],
          "mark": {
            "type": "point",
            "tooltip": true,
            "filled": false
          },
          "encoding": {
            "x": {
              "field": "Sepal Length"
            },
            "y": {"field": "y_median"}
          }
        },
        {
          "description": "y outlier values.",
          "transform": [
            {
              "filter": "datum['y_outlier']"
            }
          ],
          "mark": {
            "type": "point",
            "filled": false,
            "tooltip": true
          },
          "encoding": {
            "y": {
              "field": "Sepal Width"
            },
            "x": {"field": "x_median"}
          }
        }
      ]
    }
  ],
  "encoding": {
    "x": {
      "type": "quantitative",
      "scale": {"zero": false},
      "axis": {"title": "Sepal Length"}
    },
    "y": {
      "type": "quantitative",
      "scale": {"zero": false},
      "axis": {"title": "Sepal Width"}
    },
    "color": {"field": "Species"},
    "tooltip": [
      {"field": "Species"},
      {
        "field": "tooltip_min",
        "title": "Minimum Value"
      },
      {
        "field": "tooltip_q1",
        "title": "Lower Quartile"
      },
      {
        "field": "tooltip_median",
        "title": "Median"
      },
      {
        "field": "tooltip_q3",
        "title": "Upper Quartile"
      },
      {
        "field": "tooltip_max",
        "title": "Maximum Value"
      },
      {
        "field": "count",
        "title": "# Samples"
      }
    ]
  }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2023 22:03:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Double-box-plot/m-p/3091404#M6925</guid>
      <dc:creator>dm-p</dc:creator>
      <dc:date>2023-02-21T22:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: Double box plot</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Double-box-plot/m-p/3092391#M6927</link>
      <description>&lt;P&gt;TOP! Merci beaucoup!!&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 09:15:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Double-box-plot/m-p/3092391#M6927</guid>
      <dc:creator>JimmyCruyp</dc:creator>
      <dc:date>2023-02-22T09:15:06Z</dc:date>
    </item>
    <item>
      <title>Re: Double box plot</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Double-box-plot/m-p/3160511#M7223</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/124852"&gt;@giammariam&lt;/a&gt;&amp;nbsp;Hello to you. I had made a request to have this kind of visual. The graph seems to correspond completely to what I asked for. but when I go to see in the code, there is much too specific information that cannot answer a standard request according to what I understand. 1. I have different tables that must go in this graph. Here I see that it is indicated: "dataset". Is that a problem? 2. I see "datum" : is that a constraint? 3. I also see that we are talking about Q1, Q3. I dont understand if I need this type of data. To be more clear, is it possible to have a much more generic code. Standard? I am not sure to understand how i can use it with my data in fact. this is not clear for me...&amp;nbsp;and also if I have twenty box plots, will the size change? And if the size doesn't change, is it possible to add the size adjustment bar that you created for the other graphs? Thank you very much. This one is super important to me.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 10:02:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Double-box-plot/m-p/3160511#M7223</guid>
      <dc:creator>JimmyCruyp</dc:creator>
      <dc:date>2023-03-29T10:02:04Z</dc:date>
    </item>
    <item>
      <title>Re: Double box plot</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Double-box-plot/m-p/3160723#M7224</link>
      <description>&lt;P&gt;Hey Jim. While I certainly appreciate the tag, I'm a bit confused. Did you mean to tag&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/397"&gt;@dm-p&lt;/a&gt;&amp;nbsp;in this one? Seeing as he was the author of the solution (not to mention the creator of Deneb), he is far more fit to help you with this than I am. If I'm missing something and you still need support, let me know.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 12:02:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Double-box-plot/m-p/3160723#M7224</guid>
      <dc:creator>giammariam</dc:creator>
      <dc:date>2023-03-29T12:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: Double box plot</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Double-box-plot/m-p/3161071#M7226</link>
      <description>&lt;P&gt;Hello Giammaria, sorry for appealing to you... I know that you are not the author of the graph, but the creator of the graph specified that he did not have more time to grant this. I thought that this new visualization might interest you and that you could possibly bring it to you. Especially because I can't use it. It may be more standard yielding but also adding a possibility to enlarge or reduce the box plot. Can you help me on this? This visual is very important to me... I thanked in advance,&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 13:59:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Double-box-plot/m-p/3161071#M7226</guid>
      <dc:creator>JimmyCruyp</dc:creator>
      <dc:date>2023-03-29T13:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: Double box plot</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Double-box-plot/m-p/3163354#M7236</link>
      <description>&lt;P&gt;No problem in requesting my help, Jim, happy to help! I just didn't know if it was intentional or not, until you mentioned that Daniel no longer has bandwidth to assist with this. Now it all makes sense. I definitely would like to try to dive into this. Unfortunately, I have some other things on my list currently that take priority. Maybe consider creating a new post (and tagging me so I can support eventually). This way more people are likely to see it and may be able to help before I can get to it since that post will not already be marked as "solved."&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2023 12:12:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Double-box-plot/m-p/3163354#M7236</guid>
      <dc:creator>giammariam</dc:creator>
      <dc:date>2023-03-30T12:12:11Z</dc:date>
    </item>
  </channel>
</rss>

