mirror of
https://github.com/apache/superset.git
synced 2026-04-20 00:24:38 +00:00
Add NVD3's bullet chart (#1775)
* Add NVD3's bullet chart. * Add empty lines before nested function definitions. * Add thumbnail for bullet chart. * Add bullet chart to gallery.rst. * Add "requiresTime: false", fix indentation. * Avoid scaling bullet chart vertically. * Use a default if no range is specified. * Fix coloring of bullet chart.
This commit is contained in:
committed by
Maxime Beauchemin
parent
afb3c24d5a
commit
2993ff1d75
@@ -252,6 +252,10 @@ function nvd3Vis(slice) {
|
||||
chart.maxBoxWidth(75); // prevent boxes from being incredibly wide
|
||||
break;
|
||||
|
||||
case 'bullet':
|
||||
chart = nv.models.bulletChart();
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Error('Unrecognized visualization for nvd3' + vizType);
|
||||
}
|
||||
@@ -261,6 +265,9 @@ function nvd3Vis(slice) {
|
||||
}
|
||||
|
||||
let height = slice.height() - 15;
|
||||
if (vizType === 'bullet') {
|
||||
height = Math.min(height, 50);
|
||||
}
|
||||
|
||||
chart.height(height);
|
||||
slice.container.css('height', height + 'px');
|
||||
@@ -309,7 +316,9 @@ function nvd3Vis(slice) {
|
||||
chart.y2Axis.tickFormat(d3.format(fd.y_axis_format));
|
||||
}
|
||||
}
|
||||
chart.color((d) => category21(d[colorKey]));
|
||||
if (vizType !== 'bullet') {
|
||||
chart.color((d) => category21(d[colorKey]));
|
||||
}
|
||||
|
||||
if (fd.x_axis_label && fd.x_axis_label !== '' && chart.xAxis) {
|
||||
let distance = 0;
|
||||
|
||||
Reference in New Issue
Block a user