Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
b994d099
Unverified
Commit
b994d099
authored
7 years ago
by
Cam Saul
Browse files
Options
Downloads
Patches
Plain Diff
Use same column order in tooltips
parent
d2750b15
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend/src/metabase/visualizations/lib/apply_tooltips.js
+16
-11
16 additions, 11 deletions
frontend/src/metabase/visualizations/lib/apply_tooltips.js
with
16 additions
and
11 deletions
frontend/src/metabase/visualizations/lib/apply_tooltips.js
+
16
−
11
View file @
b994d099
...
...
@@ -83,20 +83,25 @@ function applyChartTooltips(chart, series, isStacked, isNormalized, isScalarSeri
const
row
=
(
rowIndex
!=
null
)
&&
seriesData
.
rows
[
rowIndex
];
const
rawRow
=
row
&&
row
.
_origin
&&
row
.
_origin
.
row
;
// get the raw query result row
// make sure the row index we've determined with our formula above is correct. Check the
// x/y axis values ("key" & "value") and make sure they match up with the row before
push
ing
//
extra
data for the tooltip
// x/y axis values ("key" & "value") and make sure they match up with the row before
sett
ing
//
the
data for the tooltip
if
(
rawRow
&&
row
[
0
]
===
d
.
data
.
key
&&
row
[
1
]
===
d
.
data
.
value
)
{
// loop over all the columns returned with the query
for
(
let
colIndex
=
0
;
colIndex
<
rawCols
.
length
;
colIndex
++
)
{
const
col
=
rawCols
[
colIndex
];
// skip over the x/y column since those will already be included
if
(
col
===
cols
[
0
]
||
col
===
cols
[
1
])
continue
;
data
.
push
({
// rather than just append the additional values we'll just create a new `data` array.
// simply appending the additional values would result in tooltips whose order switches
// between different series.
// Loop over *all* of the columns and create the new array
data
=
rawCols
.
map
((
col
,
i
)
=>
{
// if this was one of the original x/y columns keep the original object because it
// may have the `isNormalized` tweak above.
if
(
col
===
data
[
0
].
col
)
return
data
[
0
];
if
(
col
===
data
[
1
].
col
)
return
data
[
1
];
// otherwise just create a new object for any other columns.
return
{
key
:
getFriendlyName
(
col
),
value
:
rawRow
[
colIndex
],
value
:
rawRow
[
i
],
col
:
col
}
)
;
}
};
}
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment