[multibar horizontal] added showXAxis and showYAxis option to chart.

master
Robin Hu 11 years ago
parent 3681e52ed6
commit 7a410c57ba

@ -8972,6 +8972,8 @@ nv.models.multiBarHorizontalChart = function() {
, color = nv.utils.defaultColor() , color = nv.utils.defaultColor()
, showControls = true , showControls = true
, showLegend = true , showLegend = true
, showXAxis = true
, showYAxis = true
, stacked = false , stacked = false
, tooltips = true , tooltips = true
, tooltip = function(key, x, y, e, graph) { , tooltip = function(key, x, y, e, graph) {
@ -9173,6 +9175,7 @@ nv.models.multiBarHorizontalChart = function() {
//------------------------------------------------------------ //------------------------------------------------------------
// Setup Axes // Setup Axes
if (showXAxis) {
xAxis xAxis
.scale(x) .scale(x)
.ticks( availableHeight / 24 ) .ticks( availableHeight / 24 )
@ -9185,9 +9188,11 @@ nv.models.multiBarHorizontalChart = function() {
xTicks xTicks
.selectAll('line, text') .selectAll('line, text')
.style('opacity', 1) .style('opacity', 1);
}
if (showYAxis) {
yAxis yAxis
.scale(y) .scale(y)
.ticks( availableWidth / 100 ) .ticks( availableWidth / 100 )
@ -9197,6 +9202,8 @@ nv.models.multiBarHorizontalChart = function() {
.attr('transform', 'translate(0,' + availableHeight + ')'); .attr('transform', 'translate(0,' + availableHeight + ')');
g.select('.nv-y.nv-axis').transition() g.select('.nv-y.nv-axis').transition()
.call(yAxis); .call(yAxis);
}
//------------------------------------------------------------ //------------------------------------------------------------
@ -9341,6 +9348,18 @@ nv.models.multiBarHorizontalChart = function() {
return chart; return chart;
}; };
chart.showXAxis = function(_) {
if (!arguments.length) return showXAxis;
showXAxis = _;
return chart;
};
chart.showYAxis = function(_) {
if (!arguments.length) return showYAxis;
showYAxis = _;
return chart;
};
chart.tooltip = function(_) { chart.tooltip = function(_) {
if (!arguments.length) return tooltip; if (!arguments.length) return tooltip;
tooltip = _; tooltip = _;

@ -18,6 +18,8 @@ nv.models.multiBarHorizontalChart = function() {
, color = nv.utils.defaultColor() , color = nv.utils.defaultColor()
, showControls = true , showControls = true
, showLegend = true , showLegend = true
, showXAxis = true
, showYAxis = true
, stacked = false , stacked = false
, tooltips = true , tooltips = true
, tooltip = function(key, x, y, e, graph) { , tooltip = function(key, x, y, e, graph) {
@ -219,6 +221,7 @@ nv.models.multiBarHorizontalChart = function() {
//------------------------------------------------------------ //------------------------------------------------------------
// Setup Axes // Setup Axes
if (showXAxis) {
xAxis xAxis
.scale(x) .scale(x)
.ticks( availableHeight / 24 ) .ticks( availableHeight / 24 )
@ -231,9 +234,11 @@ nv.models.multiBarHorizontalChart = function() {
xTicks xTicks
.selectAll('line, text') .selectAll('line, text')
.style('opacity', 1) .style('opacity', 1);
}
if (showYAxis) {
yAxis yAxis
.scale(y) .scale(y)
.ticks( availableWidth / 100 ) .ticks( availableWidth / 100 )
@ -243,6 +248,8 @@ nv.models.multiBarHorizontalChart = function() {
.attr('transform', 'translate(0,' + availableHeight + ')'); .attr('transform', 'translate(0,' + availableHeight + ')');
g.select('.nv-y.nv-axis').transition() g.select('.nv-y.nv-axis').transition()
.call(yAxis); .call(yAxis);
}
//------------------------------------------------------------ //------------------------------------------------------------
@ -387,6 +394,18 @@ nv.models.multiBarHorizontalChart = function() {
return chart; return chart;
}; };
chart.showXAxis = function(_) {
if (!arguments.length) return showXAxis;
showXAxis = _;
return chart;
};
chart.showYAxis = function(_) {
if (!arguments.length) return showYAxis;
showYAxis = _;
return chart;
};
chart.tooltip = function(_) { chart.tooltip = function(_) {
if (!arguments.length) return tooltip; if (!arguments.length) return tooltip;
tooltip = _; tooltip = _;

Loading…
Cancel
Save