mirror of
https://github.com/bendtherules/line_chart_demo.git
synced 2026-08-18 13:52:30 +00:00
tmp
This commit is contained in:
+1
-1
@@ -9,7 +9,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="chart-container">
|
<div class="chart-container">
|
||||||
<line-chart data-points="[[2,2],[3,4],[6,5],[40,3]]"></line-chart>
|
<line-chart data-points="[[20,200],[3,4],[6,5],[40,3]]"></line-chart>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript" src="index.js"></script>
|
<script type="text/javascript" src="index.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
|
|
||||||
var all_data_points = []
|
var all_data_points = []
|
||||||
|
|
||||||
|
// all_data_points = [ [[x1,y1],[x2,y2],[another point]], [another chart] ]
|
||||||
|
|
||||||
// gather all data
|
// gather all data
|
||||||
d3.selectAll("line-chart").each( function () {
|
d3.selectAll("line-chart").each( function () {
|
||||||
var ele = d3.select(this)
|
var ele = d3.select(this)
|
||||||
@@ -9,3 +11,12 @@ d3.selectAll("line-chart").each( function () {
|
|||||||
|
|
||||||
|
|
||||||
// ele_line_chart.append(".chart-clean-box").style({"padding":0}).node().getBoundingClientRect()
|
// ele_line_chart.append(".chart-clean-box").style({"padding":0}).node().getBoundingClientRect()
|
||||||
|
|
||||||
|
var list_ele_clean_box = d3.selectAll("line-chart").append("div").classed("chart-clean-box",true).attr("padding",0).data(all_data_points)
|
||||||
|
|
||||||
|
list_ele_clean_box.each( function (data_chart, index_chart) {
|
||||||
|
var ele_chart = d3.select(this);
|
||||||
|
var bbox = this.getBoundingClientRect();
|
||||||
|
|
||||||
|
ele_chart.data(data_chart).append("svg").width(bbox.width).height(bbox.height)
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user