In [1]:
import numpy as np
import pandas as pd
from IPython.display import Javascript, HTML
In [5]:
%%javascript
require.config({
baseUrl: '/files',
paths: {
d3: 'lib/d3',
bp_vis: 'src/bus_perf'
}
});
In [ ]:
In [33]:
%%javascript
require(['d3', 'bp_vis'],
function (d3, bp_vis) {
var data_path = "data/bus_perf.json";
var chart_id = '#chart1'
$(chart_id).remove();
element.append("<div id='" + chart_id.slice(1,) + "'></div>");
$(chart_id).width("800px");
$(chart_id).height("300px");
d3.json(data_path, function (x) {bp_vis.draw(x, chart_id)});
});
In [32]:
%%javascript
require(['d3', 'bp_vis'],
function (d3, bp_vis) {
var data_path = "data/bus_perf.json";
var chart_id = '#chart2'
$(chart_id).remove();
console.log(chart_id.slice(-1))
element.append("<div id='" + chart_id.slice(1,) + "'></div>");
$(chart_id).width("800px")
$(chart_id).height("300px");
d3.json(data_path, function (x) {bp_vis.draw(x, chart_id)});
});
In [ ]: