저는 CSV가 있으며 모든 브랜드 + 날짜에 대해 별도의 차트를 원합니다.csv의 모든 열에 대해 별도의 차트를 만드는 방법
date,Apple,Google,Amazon,Microsoft,IBM,Facebook
2015-08-11,113.489998,690.299988,527.460022,46.41,155.509995,93.620003
2015-08-10,119.720001,663.140015,524,47.330002,156.75,94.150002
2015-08-07,115.519997,664.390015,522.619995,46.740002,155.119995,94.300003
2015-08-06,115.129997,670.150024,529.460022,46.619999,156.320007,95.120003
2015-08-05,115.400002,673.289978,537.01001,47.580002,157.899994,96.440002
은 지금 나는 모든 브랜드에 대한 코드를 생성 할 수 있습니다, 그리고 난 6 개 별도의 차트를 얻을. 그러나 나는 이것을위한 간단한 해결책이 있어야한다고 생각한다. 지금은
// Adds the svg canvas
var chart1 = d3.select("body")
.append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
// Get the data
d3.csv("data1.php", function(error, data) {
data.forEach(function(d) {
d.date = parseDate(d.date);
d.m_data = +d.mrr;
});
// Scale the range of the data
x.domain(d3.extent(data, function(d) { return d.date; }));
y.domain([d3.min(data, function(d) { return d.mrr; }), d3.max(data, function(d) { return d.mrr; })]);
// Add the valueline path.
chart1.append("path")
.attr("class", "line")
.attr("d", valueline(data));
// Add the X Axis
chart1.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0," + height + ")")
.call(xAxis);
// Add the Y Axis
chart1.append("g")
.attr("class", "y axis")
.call(yAxis);
chart1.append("text")
.attr("x", width/2)
.attr("y", 0)
.style("text-anchor", "middle")
.text("mrr");
});
어떻게 그 하나 개의 차트의 모든 행이 @Cyril, multiseries 라인 차트 https://bl.ocks.org/mbostock/3884955 – Cyril
을 약하지만, 별도의 차트 "창"에있는 모든 라인이 필요합니다 – SERG