- ES6
- with dependencies
export default+ assignment expressionexport+ declaration
- without dependencies
export default+ assignment expressionexport+ declaration
- with dependencies
- Common JS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function() { | |
| "use strict"; | |
| d3.json("bullets.json", function(error, data) { | |
| var myChart = d3.select("body").chart("Bullets", { | |
| seriesCount: data.length | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <style> | |
| body { | |
| font: 10px sans-serif; | |
| } | |
| .axis path, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var LineChart = d3.chart("Line", { | |
| initialize: function() { | |
| var path = this.base.append("path") | |
| .classed("line", true); | |
| var x = this.x = d3.time.scale() | |
| .range([0, width]); | |
| var y = this.y = d3.scale.linear() | |
| .range([height, 0]); | |
| var line = d3.svg.line() | |
| .x(function(d) { return x(d.date); }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| d3.chart('BaseChart').extend('GroupedBarChart', { | |
| initialize : function() { | |
| var chart = this; | |
| chart.margin = {top: 40, right: 20, bottom: 40, left: 60}; | |
| chart.xScale = d3.scale.ordinal().rangeRoundBands([0, chart.width()], 0.1); | |
| chart.x1Scale = d3.scale.ordinal(); | |
| chart.yScale = d3.scale.linear().range([chart.height(), 0]); | |
| chart.color = d3.scale.category10(); | |
| chart.duration = 500; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <style> | |
| body { | |
| font: 10px sans-serif; | |
| } | |
| .axis path, |
NewerOlder