I am recently moving to jupyter lab from jupyter notebook and some problem occured to me.
I am using a js lib to visualize my data and it seems to be not working with jupyter lab. The code is fine to display a graph on jupyter notebook. So i am wondering why. Here is the code.
from IPython.display import HTML
lgdstr = """
var axisData = """ + str(['2005-09-30','2005-12-31', '2006-06-30','2006-09-30', '2006-10-30',
'2006-11-29','2006-12-31','2007-06-30','2007-09-30', '2007-12-31','2008-06-30', '2008-09-30', '2008-12-31','2009-03-31', '2009-06-30', '2009-09-28', '2009-09-30', '2009-12-31','2010-03-31', '2010-06-30',
'2010-09-30','2010-10-14', '2010-12-31','2011-03-31','2011-06-30','2011-09-30','2011-12-31','2012-03-31',
'2012-06-30','2012-09-30','2012-12-31','2013-03-31', '2013-06-30','2013-09-30','2013-12-31', '2014-03-31',
'2014-06-30','2014-09-30','2014-12-31','2015-03-31', '2015-06-30', '2015-09-30','2015-12-31', '2016-03-15','2016-03-18', '2016-03-31', '2016-06-30', '2016-09-30', '2016-12-31', '2017-03-31', '2017-06-30', '2017-08-31', '2017-09-04','2017-09-30', '2017-12-31', '2018-03-31', '2018-06-30','2018-09-30','2018-12-31',
'2019-03-31', '2019-06-30']) + """;
var data = """ + str(['37.94','37.31','45.81', '45.81', '45.81','47.20','47.11','48.82', '47.99', '47.39', '47.09','45.48', '44.38',
'44.24', '43.86','40.82', '40.84', '41.11','40.95', '41.10','41.11', '52.00','52.51', '52.51', '52.09','52.06',
'51.95', '50.35','50.08', '50.13','49.35', '48.95', '49.34', '49.36', '49.47', '49.87', '48.72', '49.29', '48.81','48.90',
'50.25', '62.05', '70.70', '73.16', '73.27','73.25','73.42','73.32', '73.42', '73.63', '74.04', '74.29','75.40','75.55',
'76.06','76.28', '76.28', '76.37', '76.37', '76.42', '76.51']) + """;
var links = data.map(function (item, i) {
return {
source: i,
target: i + 1
};
});
links.pop();
option = {
title: {
text: '【浦发银行】前十大流通股东持股占比'
},
tooltip: {
trigger: 'item'
},
xAxis: {
type : 'category',
boundaryGap : false,
data : axisData
},
yAxis: {
type : 'value'
},
series: [
{
type: 'line',
layout: 'none',
coordinateSystem: 'cartesian2d',
symbolSize: 10,
label: {
normal: {
show: true
}
},
edgeSymbol: ['circle', 'arrow'],
edgeSymbolSize: [2, 5],
data: data,
links: links,
lineStyle: {
normal: {
color: '#2f4554'
}
}
}
]
};
"""
headstr = """
<div id="showhere" style="width:800px; height:600px;"></div>
<script>
require.config({ paths:{ echarts: '//cdn.bootcss.com/echarts/3.2.3/echarts.min', } });
require(['echarts'],function(ec){
var myChart = ec.init(document.getElementById('showhere'));
"""
tailstr = """
myChart.setOption(option);
});
</script>
"""
HTML(headstr + lgdstr + tailstr)
i have some screenshots
the upper one is how it looks in jupyter lab and the lower one is how it looks in jupyter notebook
Can I get some help~