iros / d3.chart.base Goto Github PK
View Code? Open in Web Editor NEWA base chart for creating d3.chart based charts.
License: MIT License
A base chart for creating d3.chart based charts.
License: MIT License
Do you think margins have a place in a base chart such as this one? How have you implemented margins in your work with d3.chart so far?
Hi! Just a quick question.
I noticed here all the attributes had an underscore in front (_width
), whereas in the introduction, some had an underscore, but the xScale
didn't.
Could you explain this pattern? I thought underscores typically represented private attributes.
I'm trying to understand the initAttr
function:
function _initAttr(internalName, d3Name, defaultValue) {
if (!this.base.attr(d3Name)) {
this[internalName] = defaultValue;
this.base.attr(d3Name, defaultValue);
} else {
this[internalName] = this.base.attr(d3Name);
}
}
It seems like after you use it
// make sure container height and width are set.
_initAttr.call(this, "_width", "width", 200);
_initAttr.call(this, "_height", "height", 200);
these lines become unnecessary:
// setup some reasonable defaults
chart._width = chart.base.attr("width") || 200;
chart._height = chart.base.attr("height") || 200;
since in either case (svg width/height are already set, or they're not) the initAttr
function is assigning a value to this._width and this._height. What am I missing?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.