-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from RhoInc/v1.2.0
Query Overview v1.2.0
- Loading branch information
Showing
48 changed files
with
2,025 additions
and
1,110 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
export default function onDataTransform() { | ||
const context = this; | ||
} | ||
export default function onDataTransform() {} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
export default function onDestroy() { | ||
const context = this; | ||
} | ||
export default function onDestroy() {} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,7 @@ | ||
export default function onDraw() { | ||
const context = this; | ||
|
||
//Sort summarized data by descending total. | ||
this.current_data.sort(function(a, b) { | ||
return b.total < a.total ? -1 : b.total > a.total ? 1 : b.total >= a.total ? 0 : NaN; | ||
}); | ||
|
||
//Sort y-domain by descending total. | ||
this.y_dom.sort(function(a, b) { | ||
var order = context.current_data.map(function(d) { | ||
return d.key; | ||
}); | ||
return order.indexOf(b) < order.indexOf(a) | ||
? -1 | ||
: order.indexOf(b) > order.indexOf(a) | ||
? 1 | ||
: order.indexOf(b) >= order.indexOf(a) | ||
? 0 | ||
: NaN; | ||
}); | ||
|
||
//Limit y-domain to key values in summarized data. | ||
this.y_dom = this.y_dom.filter(function(d, i) { | ||
return ( | ||
context.current_data | ||
.map(function(d) { | ||
return d.key; | ||
}) | ||
.indexOf(d) > -1 | ||
); | ||
}); | ||
import setYDomain from './onDraw/setYDomain'; | ||
import setChartHeight from './onDraw/setChartHeight'; | ||
|
||
//Limit y-domain to first [chart.config.cutoff] values. | ||
this.y_dom = this.y_dom.filter(function(d, i) { | ||
return i >= context.y_dom.length - context.config.cutoff; | ||
}); | ||
|
||
this.y_dom = this.config.alphabetize ? this.y_dom.sort(d3.descending) : this.y_dom; | ||
|
||
//change chart height to match the current number of bars displayed | ||
this.raw_height = | ||
(+this.config.range_band + this.config.range_band * this.config.padding) * | ||
this.y_dom.length; | ||
export default function onDraw() { | ||
setYDomain.call(this); | ||
setChartHeight.call(this); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export default function setChartHeight() { | ||
//Match chart height to number of bars currently displayed. | ||
this.raw_height = | ||
(+this.config.range_band + this.config.range_band * this.config.padding) * | ||
this.y_dom.length; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
export default function setYDomain() { | ||
//Sort summarized data by descending total. | ||
this.current_data.sort( | ||
(a, b) => (b.total < a.total ? -1 : b.total > a.total ? 1 : b.total >= a.total ? 0 : NaN) | ||
); | ||
|
||
//Sort y-domain by descending total. | ||
this.y_dom.sort((a, b) => { | ||
const order = this.current_data.map(d => d.key); | ||
return order.indexOf(b) < order.indexOf(a) | ||
? -1 | ||
: order.indexOf(b) > order.indexOf(a) | ||
? 1 | ||
: order.indexOf(b) >= order.indexOf(a) ? 0 : NaN; | ||
}); | ||
|
||
//Limit y-domain to key values in summarized data. | ||
this.y_dom = this.y_dom.filter(d => this.current_data.map(di => di.key).indexOf(d) > -1); | ||
|
||
//Sort y-domain alphanumerically or descending total. | ||
this.y_dom = this.config.alphabetize ? this.y_dom.sort(d3.descending) : this.y_dom; | ||
|
||
//Limit y-domain to first [chart.config.cutoff] values. | ||
if (this.config.cutoff !== 'All') | ||
this.y_dom = this.y_dom.filter((d, i) => i >= this.y_dom.length - this.config.cutoff); | ||
} |
Oops, something went wrong.