Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add enabled option to legend #248

Merged
merged 5 commits into from
Jan 27, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion dist/contour.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Contour - v1.0.1 - 2016-12-28 */
/*! Contour - v1.0.1 - 2017-01-04 */
(function(exports, global) {
(function(undefined) {
var root = this;
Expand Down Expand Up @@ -2797,6 +2797,10 @@
this.options = _.merge({}, (this.renderer || {}).defaults || {}, opt);
return this.ctx;
},
setVisibility: function(visible) {
var node = this.layer.node();
visible ? $(node).show() : $(node).hide();
},
_updateDomain: function() {
if (!this.options[this.type]) throw new Error("Set the options before calling setData or _updateDomain");
var isSupportedFormat = (this.ctx || {}).isSupportedDataFormat || _.nw.isSupportedDataFormat;
Expand Down Expand Up @@ -3193,6 +3197,7 @@
vAlign: "middle",
hAlign: "right",
direction: "vertical",
enabled: true,
formatter: function(d) {
return d.name;
},
Expand All @@ -3217,6 +3222,9 @@
return classes;
}
function Legend(data, layer, options) {
if (options.legend.enabled === false) {
return;
}
var container;
if (options.legend.el) {
container = d3.select(options.legend.el).node();
Expand Down
6 changes: 3 additions & 3 deletions dist/contour.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/contour.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/showcase/area/area-basic/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<link rel="stylesheet" href="http://forio.com/tools/contour/contour.min.css">

<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.js"></script>
<script src="http://forio.com/tools/contour/contour.min.js"></script>

<div class="chart area-basic"></div>
2 changes: 1 addition & 1 deletion examples/showcase/area/area-combo/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<link rel="stylesheet" href="http://forio.com/tools/contour/contour.min.css">

<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.js"></script>
<script src="http://forio.com/tools/contour/contour.min.js"></script>

<div class="chart-title">Sales by Region <div class="sub-title">2014 - Estimated</div></div>
Expand Down
2 changes: 1 addition & 1 deletion examples/showcase/area/area-stacked/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<link rel="stylesheet" href="http://forio.com/tools/contour/contour.min.css">

<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.js"></script>
<script src="http://forio.com/tools/contour/contour.min.js"></script>

<div class="chart-title">Responses by Channel</div>
Expand Down
2 changes: 1 addition & 1 deletion examples/showcase/bar/bar-basic/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<link rel="stylesheet" href="http://forio.com/tools/contour/contour.min.css">

<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.js"></script>
<script src="http://forio.com/tools/contour/contour.min.js"></script>

<div class="chart bar-basic"></div>
2 changes: 1 addition & 1 deletion examples/showcase/bar/bar-export/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<link rel="stylesheet" href="http://forio.com/tools/contour/contour.min.css">

<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.js"></script>
<script src="http://forio.com/tools/contour/contour.min.js"></script>

<div class="chart-title">Estate Tax Collection</div>
Expand Down
2 changes: 1 addition & 1 deletion examples/showcase/bar/bar-grouped/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<link rel="stylesheet" href="http://forio.com/tools/contour/contour.min.css">

<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.js"></script>
<script src="http://forio.com/tools/contour/contour.js"></script>

<div class="chart-title">Gross Tax Collection</div>
Expand Down
2 changes: 1 addition & 1 deletion examples/showcase/bar/bar-image/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<link rel="stylesheet" href="http://forio.com/tools/contour/contour.min.css">

<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.js"></script>
<script src="http://forio.com/tools/contour/contour.min.js"></script>

<div class="chart bar-basic"></div>
2 changes: 1 addition & 1 deletion examples/showcase/bar/bar-stacked/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<link rel="stylesheet" href="http://forio.com/tools/contour/contour.min.css">

<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.js"></script>
<script src="http://forio.com/tools/contour/contour.min.js"></script>

<div class="chart-title">
Expand Down
2 changes: 1 addition & 1 deletion examples/showcase/bar/bar-styled/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<link rel="stylesheet" href="http://forio.com/tools/contour/contour.min.css">

<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.js"></script>
<script src="http://forio.com/tools/contour/contour.min.js"></script>

<div class="chart bar-basic"></div>
2 changes: 1 addition & 1 deletion examples/showcase/column/column-basic/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<link rel="stylesheet" href="http://forio.com/tools/contour/contour.min.css">

<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.js"></script>
<script src="http://forio.com/tools/contour/contour.js"></script>

<div class="chart column-basic"></div>
2 changes: 1 addition & 1 deletion examples/showcase/column/column-grouped/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<link rel="stylesheet" href="http://forio.com/tools/contour/contour.min.css">

<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.js"></script>
<script src="http://forio.com/tools/contour/contour.js"></script>

<div class="chart-title">Sales - 2012 vs 2013</div>
Expand Down
2 changes: 1 addition & 1 deletion examples/showcase/column/column-stacked/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<link rel="stylesheet" href="http://forio.com/tools/contour/contour.min.css">

<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.js"></script>
<script src="http://forio.com/tools/contour/contour.min.js"></script>

<div class="chart-title">Sales by Product</div>
Expand Down
2 changes: 1 addition & 1 deletion examples/showcase/column/column-styled/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<link rel="stylesheet" href="http://forio.com/tools/contour/contour.min.css">

<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.js"></script>
<script src="http://forio.com/tools/contour/contour.js"></script>

<div class="chart-title">Per Capita Consumption of Beverages <div class="sub-title">Selected Types</div></div>
Expand Down
Loading