Skip to content

Commit

Permalink
fix(column): fixes unexpected hover/select behvaviours (#11)
Browse files Browse the repository at this point in the history
* fix(column): fixes unexpected hover/select behvaviours

* fix(column): disable selection of all type

* fix(column): +1
  • Loading branch information
elisechant authored Mar 28, 2017
1 parent 619d524 commit 3981031
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
30 changes: 12 additions & 18 deletions src/components/columnWidget/columnWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,18 @@ class ColumnWidget extends PureComponent {
animation: false,
point: {
events: {
mouseOver: this.onPointUpdate
mouseOver: this.onPointUpdate,
}
},
// allowPointSelect: true,
states: {
hover: {
color: null,
borderWidth:5,
borderColor:'Blue'
color: 'yellow',
},
select: { // required because can be selected programatically
enabled: false
}
}
},
allowPointSelect: false,
},
},
legend: {
Expand Down Expand Up @@ -83,22 +84,17 @@ class ColumnWidget extends PureComponent {
};
}


// this is the scope of point
// this has the scope of point
onPointUpdate(e) {
// console.log(this.category, this.y, this.series.name);

this.select();
emitter.emit('receive_onPointUpdate', {
seriesName: this.series.name,
label: this.category,
value: this.y,
});
}

// this has the scope of class
receiveOnPointUpdate(options, cb) {
// console.log(label, value, seriesName);

const {label, value, seriesName} = options;
const nextFauxLegend = this.state.fauxLegend.map(f => {
if (f.seriesName === seriesName) {
Expand All @@ -112,15 +108,15 @@ class ColumnWidget extends PureComponent {

componentDidMount() {
if (this.el === null) {
throw new Error('must provide a container element');
throw new Error('Must provide a container element');
}
const _options = this.state.chartOptions;
_options.chart.renderTo = this.el;
this.instance = this.props.create(_options);

// select the last column
// "hover" over the last column
const lastIdx = this.instance.series[0].data.length - 1;
this.instance.series[0].data[lastIdx].select();
this.instance.series[0].data[lastIdx].onMouseOver();
}

// todo
Expand All @@ -135,8 +131,6 @@ class ColumnWidget extends PureComponent {
const title = this.props.widget.title;
const {fauxLegend} = this.state;

console.log(...fauxLegend)

return (
<article className={`chart--${chartType}`} role="article">
<header>
Expand Down
1 change: 1 addition & 0 deletions src/hocs/withHighcharts.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {onNextFrame} from './../utils/DOM';


Highcharts.setOptions({
colors: ['#058DC7', '#50B432', '#ED561B', '#DDDF00', '#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4'],
chart: {
style: {
fontFamily: 'Open Sans,sans-serif'
Expand Down

0 comments on commit 3981031

Please sign in to comment.