Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
work in progress #200
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunkat committed Apr 5, 2017
1 parent 571b60e commit 6bfb6d4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 9 deletions.
38 changes: 30 additions & 8 deletions src/components/charts/BarChartComponent/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ const mapDataset = (dataset, prevData, labelField) => Object.keys(dataset)
.map(key => ({
key,
value: dataset[key],
valuePrev: prevData[key]
valuePrev: prevData[key] ? prevData[key] : 0
}));

export const drawData = (svg, dimensions, ranges, data, labelField, initialAnimation, prev) => {

// console.log('----Draw----');
// console.log(prev);
// console.log(data);
console.log('**************************************');
// console.log('**************************************');
let chartData = [];
data.map((item, index) => {
// console.log(item);

// console.log(index);
chartData.push({data: item, prevData: prev ? prev[index] : 0});
});
Expand All @@ -39,13 +39,24 @@ export const drawData = (svg, dimensions, ranges, data, labelField, initialAnima
.attr('width', ranges.x1.bandwidth())

.attr('y', initialAnimation ? dimensions.height : d => {
console.log(d.value);
// console.log(d.valuePrev);


if(d.valuePrev === d.value){
console.log('true');
return ranges.y(d.valuePrev)
} else {
console.log('false');
return dimensions.height;
}


// console.log(dimensions.height);


return ranges.y(d.value)
// return ranges.y(d.valuePrev)


// return dimensions.height - ranges.y(d.value)
// ranges.y(d.value)
}
Expand All @@ -54,9 +65,20 @@ export const drawData = (svg, dimensions, ranges, data, labelField, initialAnima
.attr('height', initialAnimation ? 0 : d => {
// console.log(ranges.y(d.value));

console.log('--------------------------');
// console.log('--------------------------');
// console.log(dimensions.height - ranges.y(d.valuePrev));


if(d.valuePrev === d.value){
console.log('true');
return dimensions.height - ranges.y(d.valuePrev);
} else {
console.log('false');
return 0;
}


return dimensions.height - ranges.y(d.value);
// return dimensions.height - ranges.y(d.valuePrev);
// return ranges.y(d.value)
// dimensions.height - ranges.y(d.value)

Expand All @@ -66,7 +88,7 @@ export const drawData = (svg, dimensions, ranges, data, labelField, initialAnima
.transition()
.duration(6000)
.attr('y', d => {
console.log(d.value);
// console.log(d.value);
return ranges.y(d.value);
} )
.attr('height', d => dimensions.height - ranges.y(d.value))
Expand Down
1 change: 0 additions & 1 deletion src/components/widget/DraggableWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ export class DraggableWrapper extends Component {

cards.map((item, id) => {
return (
id==4 &&
<DraggableWidget
key={item.id}
id={item.id}
Expand Down

0 comments on commit 6bfb6d4

Please sign in to comment.