<?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: Sankey/Ribbon/Alluvial style visualization in Fortune 500 app in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Sankey-Ribbon-Alluvial-style-visualization-in-Fortune-500-app/m-p/1829159#M68337</link>
    <description>&lt;P&gt;Hi Markus - Thanks for showing interest in the global 500 visualization. Our team usually jokes about what that chart should be called and the best thing we came up with was "Slokey", a combination of "slope" and "sankey", so it's funny to see that you used three names on your end to refer to it.&lt;/P&gt;&lt;P&gt;The visualization was indeed built using the Picasso.js charting library in combination with Nebula.js to access the Qlik Sense App. You can check out&amp;nbsp;&lt;A href="https://community.qlik.com/t5/Qlik-Design-Blog/Create-a-Slope-chart-with-tooltips-and-brushing-using-Nebula-js/ba-p/1827168" target="_blank" rel="noopener"&gt;this blog post&lt;/A&gt; for more information about the process and a step-by-step tutorial on how to build a chart using those tools in tandem.&lt;/P&gt;&lt;P&gt;Going back to the chart itself, we couldn't use the supported &lt;A href="https://help.qlik.com/en-US/sense/May2021/Subsystems/Hub/Content/Sense_Hub/Visualizations/VisualizationBundle/sankey-chart.htm" target="_blank" rel="noopener"&gt;Sankey chart&lt;/A&gt; because we wanted to show a 1-to-1 relationship between the same dimension (Sector) portraying the increase or decrease of our measure (profits/revenues).&lt;/P&gt;&lt;P&gt;The chart is made up of stacked bars for the 2020 and 2021 years + a custom Picasso component that links each particular sector from left to right. Please refer to &lt;A href="https://community.qlik.com/t5/Qlik-Design-Blog/nebula-js-radar-chart-with-picasso-js-custom-component/ba-p/1811534" target="_blank" rel="noopener"&gt;this blog post&lt;/A&gt;&amp;nbsp;if you would like to read more about how a Picasso custom component is built.&amp;nbsp;&lt;/P&gt;&lt;P&gt;In our case, the "links" custom component we built draws an &lt;A href="https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths" target="_blank" rel="noopener"&gt;SVG path&lt;/A&gt; as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;const d = `
          M${xStart},${y0Top}
          ${xMid},${y0Top}
          ${xEnd},${y1Top}
          ${xEnd},${y1Bottom}
          ${xMid},${y0Bottom}
          ${xStart},${y0Bottom}
          Z`;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="notion-enable-hover"&gt;Given that:&lt;BR /&gt;&lt;/SPAN&gt;&lt;EM&gt;&lt;SPAN class="notion-enable-hover"&gt;xStart refers to the x -coordinate of 2020&lt;BR /&gt;xEnd&amp;nbsp;refers to the x -coordinate of 2021&lt;BR /&gt;xMid is the mid-point between 2020 and 2021&lt;BR /&gt;y0Top is the top point of the sector on the left&lt;BR /&gt;y0Bottom is the bottom point of the sector on the right&lt;BR /&gt;y1Top is the top point of the sector on the right&lt;BR /&gt;y1Bottom is the bottom point of the sector on the right&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;SPAN class="notion-enable-hover"&gt;(In other words, the path starts drawing from the top point of the sector on the left → goes to the center → then to the top point of the sector on the right → to the bottom point of the sector on the right → back to the center → then to the bottom point of the sector on the left.)&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="notion-enable-hover"&gt;Below are code snippets for reference:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Nebula.js configuration:&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;useEffect(async () =&amp;gt; {
    if (!nebula) return;
    chartRef.current = await nebula.render({
      element: elementRef.current,
      type: 'sankey',
      fields: [
        '[Date of Issue]',
        '[Sector]',
        '=Sum({$&amp;lt;[Date of Issue]={2020, 2021}&amp;gt;} [Sector Profit])',
      ],
    });
  }, [nebula]);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Custom component "links":&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;picasso.component('links', {
    require: ['renderer', 'resolver'],
    defaultSettings: {},
    render({ data }) {
      const { items } = this.resolver.resolve({
        data,
        settings: this.settings.settings,
      });

      const layers = items.reduce((acc, curr) =&amp;gt; {
        acc[curr.data.series.label] = acc[curr.data.series.label] || { 2020: null, 2021: null };
        acc[curr.data.series.label][curr.data.label] = curr;
        return acc;
      }, {});

      const layerComponents = Object.values(layers).reduce((layerComponentsArr, layer) =&amp;gt; {
        const xStart = layer['2020'].major * this.rect.width;
        const xMid = ((layer['2021'].major + layer['2020'].major) / 2) * this.rect.width;
        const xEnd = layer['2021'].major * this.rect.width;
        const y0Top = layer['2020'].top * this.rect.height;
        const y0Bottom = layer['2020'].bottom * this.rect.height;
        const y1Top = layer['2021'].top * this.rect.height;
        const y1Bottom = layer['2021'].bottom * this.rect.height;
        const d = `
          M${xStart},${y0Top}
          ${xMid},${y0Top}
          ${xEnd},${y1Top}
          ${xEnd},${y1Bottom}
          ${xMid},${y0Bottom}
          ${xStart},${y0Bottom}
          Z`;

        return [
          ...layerComponentsArr,
          {
            type: 'path',
            d,
            fill: layer['2020'].color,
            // eslint-disable-next-line no-nested-ternary
            opacity: (layer['2020'].highlight === undefined) ? 0.6 : (layer['2020'].data.series.label === layer['2020'].highlight ? 1 : 0.2),
          },
        ];
      }, []);

      const components = [...layerComponents];
      return components;
    },
  });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Usage of the custom component:&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
    type: 'links',
    key: 'links',
    displayOrder: 1,
    data: {
    collection: 'stacked',
    },
    settings: {
    major: { scale: 'x2' },
    top: (d) =&amp;gt; d.resources.scale('y')(d.datum.start.value),
    bottom: (d) =&amp;gt; d.resources.scale('y')(d.datum.end.value),
    color: {
        scale: 'color',
        ref: 'series',
    },
    highlight,
    },
},&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The full chart extension file is attached to put everything into context.&lt;/P&gt;&lt;P&gt;Please let me know if you have any additional questions!&lt;/P&gt;</description>
    <pubDate>Tue, 17 Aug 2021 16:13:44 GMT</pubDate>
    <dc:creator>Ouadie</dc:creator>
    <dc:date>2021-08-17T16:13:44Z</dc:date>
    <item>
      <title>Sankey/Ribbon/Alluvial style visualization in Fortune 500 app</title>
      <link>https://community.qlik.com/t5/App-Development/Sankey-Ribbon-Alluvial-style-visualization-in-Fortune-500-app/m-p/1826998#M68030</link>
      <description>&lt;P&gt;Hi All&lt;/P&gt;&lt;P&gt;I was checking yesterday Qlik Sense Fortune 500 application and I liked the visual style very much.&amp;nbsp; Excellent visual design.&lt;/P&gt;&lt;P&gt;&lt;A href="https://qlik.fortune.com/global500/" target="_blank" rel="noopener"&gt;https://qlik.fortune.com/global500/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I'm a very curious to know how the Sankey/Ribbon style visualization is built (please see the attachment). Is this possible to build by using Qlik Sense (May 2021) native visualizations?&amp;nbsp; Or have they used picasso.js&amp;nbsp;&lt;SPAN&gt;open source charting library etc?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;In older Sense version there were Bar &amp;amp; Area chart but it's no longer supported. I'm just wondering if this is done by using basic Bar chart.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Aug 2021 06:53:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Sankey-Ribbon-Alluvial-style-visualization-in-Fortune-500-app/m-p/1826998#M68030</guid>
      <dc:creator>markus_myllymaki</dc:creator>
      <dc:date>2021-08-06T06:53:09Z</dc:date>
    </item>
    <item>
      <title>Re: Sankey/Ribbon/Alluvial style visualization in Fortune 500 app</title>
      <link>https://community.qlik.com/t5/App-Development/Sankey-Ribbon-Alluvial-style-visualization-in-Fortune-500-app/m-p/1829159#M68337</link>
      <description>&lt;P&gt;Hi Markus - Thanks for showing interest in the global 500 visualization. Our team usually jokes about what that chart should be called and the best thing we came up with was "Slokey", a combination of "slope" and "sankey", so it's funny to see that you used three names on your end to refer to it.&lt;/P&gt;&lt;P&gt;The visualization was indeed built using the Picasso.js charting library in combination with Nebula.js to access the Qlik Sense App. You can check out&amp;nbsp;&lt;A href="https://community.qlik.com/t5/Qlik-Design-Blog/Create-a-Slope-chart-with-tooltips-and-brushing-using-Nebula-js/ba-p/1827168" target="_blank" rel="noopener"&gt;this blog post&lt;/A&gt; for more information about the process and a step-by-step tutorial on how to build a chart using those tools in tandem.&lt;/P&gt;&lt;P&gt;Going back to the chart itself, we couldn't use the supported &lt;A href="https://help.qlik.com/en-US/sense/May2021/Subsystems/Hub/Content/Sense_Hub/Visualizations/VisualizationBundle/sankey-chart.htm" target="_blank" rel="noopener"&gt;Sankey chart&lt;/A&gt; because we wanted to show a 1-to-1 relationship between the same dimension (Sector) portraying the increase or decrease of our measure (profits/revenues).&lt;/P&gt;&lt;P&gt;The chart is made up of stacked bars for the 2020 and 2021 years + a custom Picasso component that links each particular sector from left to right. Please refer to &lt;A href="https://community.qlik.com/t5/Qlik-Design-Blog/nebula-js-radar-chart-with-picasso-js-custom-component/ba-p/1811534" target="_blank" rel="noopener"&gt;this blog post&lt;/A&gt;&amp;nbsp;if you would like to read more about how a Picasso custom component is built.&amp;nbsp;&lt;/P&gt;&lt;P&gt;In our case, the "links" custom component we built draws an &lt;A href="https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths" target="_blank" rel="noopener"&gt;SVG path&lt;/A&gt; as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;const d = `
          M${xStart},${y0Top}
          ${xMid},${y0Top}
          ${xEnd},${y1Top}
          ${xEnd},${y1Bottom}
          ${xMid},${y0Bottom}
          ${xStart},${y0Bottom}
          Z`;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="notion-enable-hover"&gt;Given that:&lt;BR /&gt;&lt;/SPAN&gt;&lt;EM&gt;&lt;SPAN class="notion-enable-hover"&gt;xStart refers to the x -coordinate of 2020&lt;BR /&gt;xEnd&amp;nbsp;refers to the x -coordinate of 2021&lt;BR /&gt;xMid is the mid-point between 2020 and 2021&lt;BR /&gt;y0Top is the top point of the sector on the left&lt;BR /&gt;y0Bottom is the bottom point of the sector on the right&lt;BR /&gt;y1Top is the top point of the sector on the right&lt;BR /&gt;y1Bottom is the bottom point of the sector on the right&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;SPAN class="notion-enable-hover"&gt;(In other words, the path starts drawing from the top point of the sector on the left → goes to the center → then to the top point of the sector on the right → to the bottom point of the sector on the right → back to the center → then to the bottom point of the sector on the left.)&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="notion-enable-hover"&gt;Below are code snippets for reference:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Nebula.js configuration:&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;useEffect(async () =&amp;gt; {
    if (!nebula) return;
    chartRef.current = await nebula.render({
      element: elementRef.current,
      type: 'sankey',
      fields: [
        '[Date of Issue]',
        '[Sector]',
        '=Sum({$&amp;lt;[Date of Issue]={2020, 2021}&amp;gt;} [Sector Profit])',
      ],
    });
  }, [nebula]);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Custom component "links":&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;picasso.component('links', {
    require: ['renderer', 'resolver'],
    defaultSettings: {},
    render({ data }) {
      const { items } = this.resolver.resolve({
        data,
        settings: this.settings.settings,
      });

      const layers = items.reduce((acc, curr) =&amp;gt; {
        acc[curr.data.series.label] = acc[curr.data.series.label] || { 2020: null, 2021: null };
        acc[curr.data.series.label][curr.data.label] = curr;
        return acc;
      }, {});

      const layerComponents = Object.values(layers).reduce((layerComponentsArr, layer) =&amp;gt; {
        const xStart = layer['2020'].major * this.rect.width;
        const xMid = ((layer['2021'].major + layer['2020'].major) / 2) * this.rect.width;
        const xEnd = layer['2021'].major * this.rect.width;
        const y0Top = layer['2020'].top * this.rect.height;
        const y0Bottom = layer['2020'].bottom * this.rect.height;
        const y1Top = layer['2021'].top * this.rect.height;
        const y1Bottom = layer['2021'].bottom * this.rect.height;
        const d = `
          M${xStart},${y0Top}
          ${xMid},${y0Top}
          ${xEnd},${y1Top}
          ${xEnd},${y1Bottom}
          ${xMid},${y0Bottom}
          ${xStart},${y0Bottom}
          Z`;

        return [
          ...layerComponentsArr,
          {
            type: 'path',
            d,
            fill: layer['2020'].color,
            // eslint-disable-next-line no-nested-ternary
            opacity: (layer['2020'].highlight === undefined) ? 0.6 : (layer['2020'].data.series.label === layer['2020'].highlight ? 1 : 0.2),
          },
        ];
      }, []);

      const components = [...layerComponents];
      return components;
    },
  });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Usage of the custom component:&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
    type: 'links',
    key: 'links',
    displayOrder: 1,
    data: {
    collection: 'stacked',
    },
    settings: {
    major: { scale: 'x2' },
    top: (d) =&amp;gt; d.resources.scale('y')(d.datum.start.value),
    bottom: (d) =&amp;gt; d.resources.scale('y')(d.datum.end.value),
    color: {
        scale: 'color',
        ref: 'series',
    },
    highlight,
    },
},&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The full chart extension file is attached to put everything into context.&lt;/P&gt;&lt;P&gt;Please let me know if you have any additional questions!&lt;/P&gt;</description>
      <pubDate>Tue, 17 Aug 2021 16:13:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Sankey-Ribbon-Alluvial-style-visualization-in-Fortune-500-app/m-p/1829159#M68337</guid>
      <dc:creator>Ouadie</dc:creator>
      <dc:date>2021-08-17T16:13:44Z</dc:date>
    </item>
    <item>
      <title>Re: Sankey/Ribbon/Alluvial style visualization in Fortune 500 app</title>
      <link>https://community.qlik.com/t5/App-Development/Sankey-Ribbon-Alluvial-style-visualization-in-Fortune-500-app/m-p/1829299#M68347</link>
      <description>&lt;P&gt;Thanks for an excellent answer! We will most probably try this at home.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Aug 2021 07:19:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Sankey-Ribbon-Alluvial-style-visualization-in-Fortune-500-app/m-p/1829299#M68347</guid>
      <dc:creator>markus_myllymaki</dc:creator>
      <dc:date>2021-08-18T07:19:41Z</dc:date>
    </item>
  </channel>
</rss>

