Phi: improve the plot extension
- add plothover and plotclick event - add a postupdate hook
This commit is contained in:
parent
847af289a5
commit
6b3d5f0601
1 changed files with 13 additions and 3 deletions
|
@ -477,8 +477,13 @@ require([
|
||||||
var value = valueAccessor() || {};
|
var value = valueAccessor() || {};
|
||||||
|
|
||||||
if (value.hover && typeof (value.hover) === 'function') {
|
if (value.hover && typeof (value.hover) === 'function') {
|
||||||
$(element).bind("plothover", function(event, pos, item) {
|
jquery(element).bind("plothover", function(event, pos, item) {
|
||||||
value.hover(pos, item);
|
value.hover.call(jquery(this).data("flotplot"), pos, item);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (value.click && typeof (value.click) === 'function') {
|
||||||
|
jquery(element).bind("plotclick", function(event, pos, item) {
|
||||||
|
value.click.call(jquery(this).data("flotplot"), pos, item);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -487,7 +492,12 @@ require([
|
||||||
var value = valueAccessor() || {};
|
var value = valueAccessor() || {};
|
||||||
var data = ko.unwrap(value.data);
|
var data = ko.unwrap(value.data);
|
||||||
var options = ko.unwrap(value.options);
|
var options = ko.unwrap(value.options);
|
||||||
jquery.plot(element, data, options);
|
var plot = jquery.plot(element, data, options);
|
||||||
|
jquery(element).data("flotplot", plot );
|
||||||
|
var postUpdate = ko.unwrap(value.postUpdate);
|
||||||
|
if( postUpdate ) {
|
||||||
|
postUpdate.call( value, element );
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue