mirror of
https://github.com/aclindsa/moneygo.git
synced 2024-10-30 07:40:05 -04:00
StackedBarChart.js: Don't skip lines in legend
This commit is contained in:
parent
1171eeac3f
commit
bef2caef12
@ -62,7 +62,6 @@ module.exports = React.createClass({
|
|||||||
|
|
||||||
var barWidth = x(0.75);
|
var barWidth = x(0.75);
|
||||||
var barStart = x(0.25) + (x(1) - barWidth)/2;
|
var barStart = x(0.25) + (x(1) - barWidth)/2;
|
||||||
var childId=0;
|
|
||||||
|
|
||||||
// Add Y axis marks and labels, and initialize positive- and
|
// Add Y axis marks and labels, and initialize positive- and
|
||||||
// negativeSum arrays
|
// negativeSum arrays
|
||||||
@ -96,9 +95,9 @@ module.exports = React.createClass({
|
|||||||
makeXLabel(i);
|
makeXLabel(i);
|
||||||
|
|
||||||
var legendMap = {};
|
var legendMap = {};
|
||||||
|
var childId=1;
|
||||||
for (var child in this.props.report.FlattenedSeries) {
|
for (var child in this.props.report.FlattenedSeries) {
|
||||||
if (this.props.report.FlattenedSeries.hasOwnProperty(child)) {
|
if (this.props.report.FlattenedSeries.hasOwnProperty(child)) {
|
||||||
childId++;
|
|
||||||
var childData = this.props.report.FlattenedSeries[child];
|
var childData = this.props.report.FlattenedSeries[child];
|
||||||
var rectClasses = "chart-element chart-color" + (childId % 12);
|
var rectClasses = "chart-element chart-color" + (childId % 12);
|
||||||
var self = this;
|
var self = this;
|
||||||
@ -115,7 +114,6 @@ module.exports = React.createClass({
|
|||||||
var value = childData[i];
|
var value = childData[i];
|
||||||
if (value == 0)
|
if (value == 0)
|
||||||
continue;
|
continue;
|
||||||
legendMap[child] = childId;
|
|
||||||
if (value > 0) {
|
if (value > 0) {
|
||||||
rectHeight = y(value) - y(0);
|
rectHeight = y(value) - y(0);
|
||||||
positiveSum[i] += rectHeight;
|
positiveSum[i] += rectHeight;
|
||||||
@ -130,6 +128,9 @@ module.exports = React.createClass({
|
|||||||
<rect onClick={rectOnClick} className={rectClasses} x={x(i) + barStart} y={rectY} width={barWidth} height={rectHeight} rx={1} ry={1}/>
|
<rect onClick={rectOnClick} className={rectClasses} x={x(i) + barStart} y={rectY} width={barWidth} height={rectHeight} rx={1} ry={1}/>
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
if (seriesBars.length > 0) {
|
||||||
|
legendMap[child] = childId;
|
||||||
|
childId++;
|
||||||
bars.push((
|
bars.push((
|
||||||
<g className="chart-series">
|
<g className="chart-series">
|
||||||
{seriesBars}
|
{seriesBars}
|
||||||
@ -137,6 +138,7 @@ module.exports = React.createClass({
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var legend = [];
|
var legend = [];
|
||||||
for (var series in legendMap) {
|
for (var series in legendMap) {
|
||||||
|
Loading…
Reference in New Issue
Block a user