That definitely looks like it would address the issues I'm seeing. Thanks
for pointing it out!

‪On Sun, Nov 13, 2016 at 12:53 AM ‫أحمد حبنكة‬‎ <[email protected]>
wrote:‬

>
>
> بتاريخ الأربعاء، 9 نوفمبر، 2016 10:11:06 ص UTC+2، كتب Austin Bingham:
>
> I'm trying to use Chart.js from my elm app, and I'm running into some
> errors that I can't sort out. In short, I've got a elm-to-javascript port
> that takes in a data structure describing the chart I want to draw. Then on
> the javascript side I've got a subscription to that port that renders that
> chart. A trimmed version of that function looks like this:
>
>     var brooksChart = null;
>
>     function chart(val) {
>              var datasets = ... // calculate data sets from `val`
>
>              var ctx = document.getElementById("bark-spider-canvas");
>
>              if (brooksChart) {
>                  brooksChart.destroy();
>              }
>
>              brooksChart = new Chart(ctx, {
>                  type: 'line',
>                  data: {
>                      datasets: datasets
>                  },
>                  options: {
>                      scales: {
>                          xAxes: [{
>                              type: 'linear',
>                              position: 'bottom'
>                          }]
>                      }
>                  }
>              });
>          };
>
> When I run this and pass data into the port, the chart is rendered
> correctly. But, at some point after the "new Chart(...)" call completes, I
> get errors in the javascript console like this:
>
> bark_spider.js:8139 Uncaught TypeError: Cannot read property 'childNodes'
> of undefined(…)addDomNodesHelp @ bark_spider.js:8139addDomNodesHelp @
> bark_spider.js:8147addDomNodesHelp @ bark_spider.js:8147addDomNodesHelp @
> bark_spider.js:8147addDomNodesHelp @ bark_spider.js:8147addDomNodes @
> bark_spider.js:8066applyPatches @ bark_spider.js:8195updateIfNeeded @
> bark_spider.js:7232
>
> The fallout of this seems to be that the elm runtime gets confused, at
> least insofar as I don't receive Msgs that I ought to be receiving. In
> fact, if I take the call to "new Chart(...)" out, then my app works just
> fine (except of course that charts aren't rendered).
>
> So, does anyone have any idea what I'm going wrong? This seems like pretty
> standard use of both ports and chart.js, but clearly I'm missing something.
>
>
>  I think your problem is related to this issue :
> https://github.com/elm-lang/html/issues/19 , the feature request is added
> in this meta issue : https://github.com/elm-lang/html/issues/53 So I
> think it's only a matter of time before we have true interop with JS :)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to