[view/flot-graph][s]: tool tips now show true x-axis value in case where non-numeric (e.g. for bar).
This commit is contained in:
parent
e51fdfe7cd
commit
dc0dc0b76e
@ -220,12 +220,19 @@ my.FlotGraph = Backbone.View.extend({
|
|||||||
var previousPoint = null;
|
var previousPoint = null;
|
||||||
this.$graph.bind("plothover", function (event, pos, item) {
|
this.$graph.bind("plothover", function (event, pos, item) {
|
||||||
if (item) {
|
if (item) {
|
||||||
if (previousPoint != item.dataIndex) {
|
if (previousPoint != item.datapoint) {
|
||||||
previousPoint = item.dataIndex;
|
previousPoint = item.datapoint;
|
||||||
|
|
||||||
$("#flot-tooltip").remove();
|
$("#flot-tooltip").remove();
|
||||||
var x = item.datapoint[0].toFixed(2),
|
var x = item.datapoint[0];
|
||||||
y = item.datapoint[1].toFixed(2);
|
var y = item.datapoint[1];
|
||||||
|
// convert back from 'index' value on x-axis (e.g. in cases where non-number values)
|
||||||
|
if (self.model.currentDocuments.models[x]) {
|
||||||
|
x = self.model.currentDocuments.models[x].get(self.chartConfig.group);
|
||||||
|
} else {
|
||||||
|
x = x.toFixed(2);
|
||||||
|
}
|
||||||
|
y = y.toFixed(2);
|
||||||
|
|
||||||
var content = _.template('<%= group %> = <%= x %>, <%= series %> = <%= y %>', {
|
var content = _.template('<%= group %> = <%= x %>, <%= series %> = <%= y %>', {
|
||||||
group: self.chartConfig.group,
|
group: self.chartConfig.group,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user