- Expert Data Visualization
- Jos Dirksen
- 116字
- 2021-07-09 18:22:48
Adding the income line
We'll quickly skim over this code, since it's pretty much the same as we used to add the indexed line:
function addIncomeLine(xScale, yIncomeScale, unadjustedCleaned) {
var lineIncome = d3.line()
.x(function(d) { return xScale(d.date); })
.y(function(d) { return yIncomeScale(d.value); })
.curve(d3.curveCatmullRom.alpha(0.5));
chart.append("path")
.attr("d", lineIncome(unadjustedCleaned))
.style("fill", "none")
.style("stroke", "steelblue")
.style("stroke-width", "2");
}
The main change here is that we don't use a gradient for the stroke but use a fixed color. The chart at this point looks like this:

At this point we have visualized the data, but the chart doesn't really look nice yet, and we don't know what the different lines really mean. We'll add this information using a couple of axes.
推薦閱讀
- 數(shù)據(jù)科學(xué)實(shí)戰(zhàn)手冊(R+Python)
- OpenCV實(shí)例精解
- Network Automation Cookbook
- Learning ArcGIS Pro
- 用Flutter極速構(gòu)建原生應(yīng)用
- Learning FuelPHP for Effective PHP Development
- 新一代SDN:VMware NSX 網(wǎng)絡(luò)原理與實(shí)踐
- Swift 4 Protocol-Oriented Programming(Third Edition)
- 軟件測試教程
- ScratchJr趣味編程動手玩:讓孩子用編程講故事
- C語言程序設(shè)計(jì)習(xí)題與實(shí)驗(yàn)指導(dǎo)
- Mastering Docker
- Magento 2 Beginners Guide
- JSP程序設(shè)計(jì)與案例實(shí)戰(zhàn)(慕課版)
- Python應(yīng)用開發(fā)技術(shù)