synw / django-chartflo-demo

Demo application for Django Chartflo
MIT License
0 stars 0 forks source link

About Altair #3

Open synw opened 6 years ago

synw commented 6 years ago

I updated the Dataswim lib with Altair 2. I tried to use it to replace the raw data timeline chart in the demo:

altair

It works fine in notebooks but refuses to display in the dashboard. The code is generated using their to_json method: source. The chart display well using the generated code if I put it in a single html page, but it refuses to display in the dashboard with absolutely no error message. I use their cdn to load the libs source. Something must be conflicting with the Altair js here. Any idea?

synw commented 6 years ago

I've found the problem: the Altair script must not be inside a Vuejs app block:

<div id="app">
  <div id="rawdata_timeline"></div>
  <!-- if the altair script is here it does not display -->
</div>
<!-- if it is here it works -->
<script>
const app = new Vue({
  el: '#app',
});
</script>

Is this an Altair bug or is it normal? I'll try to find a workaround

synw commented 6 years ago

I made a dirty workaround, demo updated (requirements update needed: Chartflo 0.5.1 and Dataswim 0.4.22)