2 nv.models.chartName = function() {
4 //============================================================
5 // Public Variables with Default Settings
6 //------------------------------------------------------------
9 var margin = {top: 30, right: 10, bottom: 10, left: 10}
12 , color = nv.utils.getColor(d3.scale.category20c().range())
13 , dispatch = d3.dispatch('stateChange', 'changeState')
16 //============================================================
19 //============================================================
21 //------------------------------------------------------------
24 //============================================================
27 function chart(selection) {
28 selection.each(function(data) {
29 var availableWidth = width - margin.left - margin.right,
30 availableHeight = height - margin.top - margin.bottom,
31 container = d3.select(this);
34 //------------------------------------------------------------
38 //------------------------------------------------------------
41 //------------------------------------------------------------
42 // Setup containers and skeleton of chart
44 var wrap = container.selectAll('g.nv-wrap.nv-chartName').data([data]);
45 var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-chartName');
46 var gEnter = wrapEnter.append('g');
47 var g = wrap.select('g')
49 gEnter.append('g').attr('class', 'nv-mainWrap');
51 wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
53 //------------------------------------------------------------
64 //============================================================
65 // Expose Public Variables
66 //------------------------------------------------------------
69 chart.dispatch = dispatch;
71 chart.options = nv.utils.optionsFunc.bind(chart);
73 chart.margin = function(_) {
74 if (!arguments.length) return margin;
75 margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
76 margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
77 margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
78 margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
82 chart.width = function(_) {
83 if (!arguments.length) return width;
88 chart.height = function(_) {
89 if (!arguments.length) return height;
94 chart.color = function(_) {
95 if (!arguments.length) return color;
96 color = nv.utils.getColor(_)
100 //============================================================