Skip to content

Commit 85d9c0c

Browse files
authored
Merge pull request #167 from jpmorganchase/material-tooltip
Material tooltip
2 parents 85d1525 + 0b0a609 commit 85d9c0c

File tree

5 files changed

+83
-79
lines changed

5 files changed

+83
-79
lines changed

packages/perspective-viewer-highcharts/src/js/config.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export function default_config(aggregates, mode) {
118118
const that = this,
119119
config = that._view._config;
120120

121-
const axis_titles = get_axis_titles(config.aggregate);
121+
const axis_titles = get_axis_titles(config.aggregate, config.sort);
122122
const pivot_titles = get_pivot_titles(config.row_pivot, config.column_pivot);
123123

124124
return {
@@ -248,10 +248,14 @@ export function default_config(aggregates, mode) {
248248
}
249249
}
250250

251-
function get_axis_titles(aggs) {
251+
function get_axis_titles(aggs, sort) {
252+
const sort_titles = sort.map(row => row[0]);
252253
let titles = [];
254+
253255
for (let i = 0; i < aggs.length; i++) {
254-
titles.push(aggs[i].column);
256+
let axis_title = aggs[i].column;
257+
if(!sort_titles.includes(axis_title))
258+
titles.push(aggs[i].column);
255259
}
256260
return titles;
257261
}

packages/perspective-viewer-highcharts/src/js/tooltip.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ export function format_tooltip(context, type, schema, axis_titles, pivot_titles)
1515
has_column_pivot = column_pivot_titles.length > 0;
1616

1717
if(type === 'area' || type === 'line' || type === 'column') {
18-
// pivots do not have a type mapping
19-
// check for pivot
18+
// pivots cannot be type-mapped
2019
let row_pivot_text = '',
2120
column_pivot_text = '';
2221

@@ -90,7 +89,7 @@ export function format_tooltip(context, type, schema, axis_titles, pivot_titles)
9089
} else if (type === 'heatmap') {
9190
return `<span>${format_value(context.point.value)}</span>`
9291
} else if (type === 'treemap' || type === 'sunburst') {
93-
return `<b>${ context.point.id }: </b><span>${format_value(context.x)}</span>`
92+
return `<span>${ context.point.id }: </span><b>${format_value(context.x)}</b>`
9493
}
9594

9695
let default_value;

packages/perspective-viewer/src/less/default.less

+7-10
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
*
88
*/
99

10+
1011
@border-color: #ccc;
12+
@sans-serif-fonts: Arial, sans-serif;
1113

1214
.psp-text-field {
1315
position: relative;
@@ -92,6 +94,8 @@
9294

9395
perspective-viewer {
9496

97+
font-family: @sans-serif-fonts;
98+
9599
.awesomplete > ul {
96100
border-radius: 0px;
97101
margin: 0px;
@@ -166,7 +170,6 @@ perspective-viewer {
166170
font-family: monospace;
167171
}
168172

169-
170173
perspective-row {
171174
border: 0px solid rgba(0,0,0,0);
172175

@@ -219,9 +222,6 @@ perspective-viewer {
219222
}
220223
}
221224

222-
223-
font-family: Arial;
224-
225225
.noselect {
226226
-webkit-touch-callout: none; /* iOS Safari */
227227
-webkit-user-select: none; /* Safari */
@@ -230,16 +230,13 @@ perspective-viewer {
230230
-ms-user-select: none; /* Internet Explorer/Edge */
231231
user-select: none; /* Non-prefixed version, currently supported by Chrome and Opera */
232232
}
233+
233234
svg text {
234-
font-family: Arial !important;
235+
font-family: @sans-serif-fonts !important;
235236
}
236237

237-
svg text {
238-
font-family: Arial !important;
239-
240-
}
241238
svg .highcharts-axis-title, svg .highcharts-axis-title {
242-
font-family: Arial !important;
239+
font-family: @sans-serif-fonts !important;
243240
}
244241
svg .highcharts-legend-box {
245242
fill: none;

packages/perspective-viewer/src/less/material.dark.less

+9-7
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
@border-color: #3B3F46;
1313

14+
@coolgrey100: #ECEFF1;
15+
@coolgrey200: #CFD8DC;
1416
@coolgrey800: #2A2C2F;
1517
@coolgrey900: #242526;
1618
@coolgrey700: #2F3136;
@@ -81,7 +83,7 @@ perspective-viewer #app {
8183
border-top-color: @coolgrey900 !important;
8284

8385
select:focus {
84-
color: #FFF !important;
86+
color: @coolgrey200 !important;
8587
}
8688

8789
.highcharts-heatmap-gradient-full {
@@ -106,7 +108,7 @@ perspective-viewer #app {
106108
}
107109

108110
svg g.highcharts-axis-labels text {
109-
fill: #FFF !important;
111+
fill: @coolgrey200 !important;
110112
}
111113

112114
rect.highcharts-background {
@@ -128,7 +130,7 @@ perspective-viewer #app {
128130
background-color: @coolgrey700;
129131

130132
tspan, text {
131-
fill: #FFF !important;
133+
fill: @coolgrey200 !important;
132134
}
133135

134136
rect, image {
@@ -143,7 +145,7 @@ perspective-viewer #app {
143145
input, select, ul, #filters {
144146
border-right: 0px;
145147
background-color: @coolgrey800;
146-
color: #fff;
148+
color: @coolgrey200;
147149
border-color: #666;
148150
}
149151

@@ -166,7 +168,7 @@ perspective-viewer #app {
166168
perspective-row {
167169

168170
#psp_row {
169-
color: #fff;
171+
color: @coolgrey200;
170172
}
171173
}
172174

@@ -180,7 +182,7 @@ perspective-viewer #app {
180182

181183
.row_draggable {
182184
border-color: #666;
183-
color: #fff;
185+
color: @coolgrey200;
184186
}
185187
}
186188
}
@@ -238,7 +240,7 @@ perspective-viewer #app {
238240
}
239241

240242
#name {
241-
color: #fff;
243+
color: @coolgrey200;
242244
}
243245

244246
#name:before {

0 commit comments

Comments
 (0)