<?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 Why will my picasso.js graph not render? in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Why-will-my-picasso-js-graph-not-render/m-p/2085336#M88996</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I'm trying out picasso.js and I'm following along with &lt;A href="https://observablehq.com/@mindspank/picasso-js-introduction" target="_self"&gt;this guide&lt;/A&gt;. I believe I did everything it says to do yet my graph won't render.&lt;/P&gt;
&lt;P&gt;Here is my code:&lt;/P&gt;
&lt;P&gt;index.html:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;lt;html&amp;gt;
    &amp;lt;head&amp;gt;
        &amp;lt;script src="https://cdn.jsdelivr.net/npm/picasso.js" crossorigin&amp;gt;&amp;lt;/script&amp;gt;
        &amp;lt;script src="./logic.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;/head&amp;gt;
    &amp;lt;body onload="load()"&amp;gt;
        &amp;lt;div id="barChartContainer"&amp;gt;chart goes here&amp;lt;/div&amp;gt;
    &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;logic.js:&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;//import picasso from 'picasso.js';

var exampledata = [
    {
        type: "matrix",
        data: [
            ["Month", "Sales", "Margin"],
            ["Jan", 1106, 7],
            ["Feb", 5444, 53],
            ["Mar", 3450, 64],
            ["Apr", 7499, 47],
            ["May", 4300, 62],
            ["June", 9735, 13],
            ["July", 7435, 15],
            ["Aug", 1482, 45],
            ["Sep", 2659, 76],
            ["Oct", 1261, 73],
            ["Nov", 3085, 56],
            ["Dec", 3035, 91]
        ]
    }
];

var scales = {
    month: {
        data: {
            field: "Month"
        }
    },
    sales: {
        data: {
            field: "Sales"
        },
        invert: true,
        expand: 0.1,
        include: [0]
    },
    margin: {
        data: {
            field: "Margin"
        },
        include: [0]
    }
};

var barcomponent = [{
    type: 'box',
    data: {
      extract: {
        field: 'Month',
        props: {
          start: 0,
          end: {
            field: 'Sales'
          }
        }
      }
    },
    settings: {
      major: {
        scale: 'month'
      },
      minor: {
        scale: 'sales'
      }
    }
}];

var axiscomponents = [
    {
        type: "axis",
        scale: "month",
        dock: "bottom"
    },
    {
        type: "axis",
        scale: "sales",
        dock: "left"
    }
];

function load() {
    var barChartContainer = document.querySelector('#barChartContainer');

    console.log(barChartContainer);
    console.log(axiscomponents);
    console.log(barcomponent);
    console.log(scales);
    console.log(exampledata);

    picasso.chart({
        element: barChartContainer, // Referencing our container cell
        data: exampledata,
        settings: {
          scales: scales,
          components: [].concat(barcomponent, axiscomponents) // Concat the bar and axis' into a single array
        }
    });
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It seems to be grabbing and using the main div where the chart is to be injected as I'm no longer seeing the text "chart goes here" but I just get a blank screen instead. My console logs print out with the expected data so I know the main "load" function is running.&lt;/P&gt;
&lt;P&gt;Can anyone see what could be wrong? Thanks!&lt;/P&gt;</description>
    <pubDate>Mon, 19 Jun 2023 13:41:47 GMT</pubDate>
    <dc:creator>gibran-shah</dc:creator>
    <dc:date>2023-06-19T13:41:47Z</dc:date>
    <item>
      <title>Why will my picasso.js graph not render?</title>
      <link>https://community.qlik.com/t5/App-Development/Why-will-my-picasso-js-graph-not-render/m-p/2085336#M88996</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I'm trying out picasso.js and I'm following along with &lt;A href="https://observablehq.com/@mindspank/picasso-js-introduction" target="_self"&gt;this guide&lt;/A&gt;. I believe I did everything it says to do yet my graph won't render.&lt;/P&gt;
&lt;P&gt;Here is my code:&lt;/P&gt;
&lt;P&gt;index.html:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;lt;html&amp;gt;
    &amp;lt;head&amp;gt;
        &amp;lt;script src="https://cdn.jsdelivr.net/npm/picasso.js" crossorigin&amp;gt;&amp;lt;/script&amp;gt;
        &amp;lt;script src="./logic.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;/head&amp;gt;
    &amp;lt;body onload="load()"&amp;gt;
        &amp;lt;div id="barChartContainer"&amp;gt;chart goes here&amp;lt;/div&amp;gt;
    &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;logic.js:&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;//import picasso from 'picasso.js';

var exampledata = [
    {
        type: "matrix",
        data: [
            ["Month", "Sales", "Margin"],
            ["Jan", 1106, 7],
            ["Feb", 5444, 53],
            ["Mar", 3450, 64],
            ["Apr", 7499, 47],
            ["May", 4300, 62],
            ["June", 9735, 13],
            ["July", 7435, 15],
            ["Aug", 1482, 45],
            ["Sep", 2659, 76],
            ["Oct", 1261, 73],
            ["Nov", 3085, 56],
            ["Dec", 3035, 91]
        ]
    }
];

var scales = {
    month: {
        data: {
            field: "Month"
        }
    },
    sales: {
        data: {
            field: "Sales"
        },
        invert: true,
        expand: 0.1,
        include: [0]
    },
    margin: {
        data: {
            field: "Margin"
        },
        include: [0]
    }
};

var barcomponent = [{
    type: 'box',
    data: {
      extract: {
        field: 'Month',
        props: {
          start: 0,
          end: {
            field: 'Sales'
          }
        }
      }
    },
    settings: {
      major: {
        scale: 'month'
      },
      minor: {
        scale: 'sales'
      }
    }
}];

var axiscomponents = [
    {
        type: "axis",
        scale: "month",
        dock: "bottom"
    },
    {
        type: "axis",
        scale: "sales",
        dock: "left"
    }
];

function load() {
    var barChartContainer = document.querySelector('#barChartContainer');

    console.log(barChartContainer);
    console.log(axiscomponents);
    console.log(barcomponent);
    console.log(scales);
    console.log(exampledata);

    picasso.chart({
        element: barChartContainer, // Referencing our container cell
        data: exampledata,
        settings: {
          scales: scales,
          components: [].concat(barcomponent, axiscomponents) // Concat the bar and axis' into a single array
        }
    });
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It seems to be grabbing and using the main div where the chart is to be injected as I'm no longer seeing the text "chart goes here" but I just get a blank screen instead. My console logs print out with the expected data so I know the main "load" function is running.&lt;/P&gt;
&lt;P&gt;Can anyone see what could be wrong? Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2023 13:41:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Why-will-my-picasso-js-graph-not-render/m-p/2085336#M88996</guid>
      <dc:creator>gibran-shah</dc:creator>
      <dc:date>2023-06-19T13:41:47Z</dc:date>
    </item>
  </channel>
</rss>

