fixing small issues

This commit is contained in:
ppisljar 2016-12-09 20:37:20 +01:00
parent a1553bc7cf
commit 2867c2d8c2
5 changed files with 14 additions and 7 deletions

View file

@ -65,7 +65,6 @@
class="kuiInput kuiSideBarInput"
ng-model="vis.params.colorsNumber"
type="number"
ng-required="vis.params.setColorRange"
greater-than="1"
less-than="11"
>

View file

@ -1,6 +1,6 @@
import uiModules from 'ui/modules';
import heatmapOptionsTemplate from 'plugins/kbn_vislib_vis_types/controls/heatmap_options.html';
import colorFunc from 'ui/vislib/components/color/heatmap_color';
import defaults from 'lodash';
const module = uiModules.get('kibana');
module.directive('heatmapOptions', function ($parse, $compile, getAppState) {
@ -30,7 +30,9 @@ module.directive('heatmapOptions', function ($parse, $compile, getAppState) {
};
$scope.getColor = function (index) {
const colors = $scope.uiState.get('vis.colors');
const defaultColors = this.uiState.get('vis.defaultColors');
const overwriteColors = this.uiState.get('vis.colors');
const colors = defaultColors ? defaults({}, overwriteColors, defaultColors) : overwriteColors;
return colors ? Object.values(colors)[index] : 'transparent';
};

View file

@ -27,6 +27,7 @@ export default function HeatmapVisType(Private) {
percentageMode: true,
cellLabels: false,
valueAxes: [{
show: false,
id: 'ValueAxis-1',
type: 'value',
scale: {

View file

@ -277,7 +277,7 @@ export default function AxisFactory(Private) {
return function (selection) {
const n = selection[0].length;
if (self.axisTitle) {
if (config.get('show') && self.axisTitle) {
self.axisTitle.render(selection);
}
selection.each(function () {

View file

@ -155,6 +155,7 @@ export default function HeatmapChartFactory(Private) {
function label(d) {
const colorBucket = getColorBucket(d);
if (colorBucket === -1) d.hide = true;
return labels[colorBucket];
}
@ -178,7 +179,11 @@ export default function HeatmapChartFactory(Private) {
.attr('height', squareHeight)
.attr('data-label', label)
.attr('fill', z)
.attr('style', 'cursor: pointer; stroke: black; stroke-width: 0.3px');
.attr('style', 'cursor: pointer; stroke: black; stroke-width: 0.3px')
.style('display', d => {
return d.hide ? 'none' : 'initial';
});
// todo: verify that longest label is not longer than the barwidth
// or barwidth is not smaller than textheight (and vice versa)
@ -193,9 +198,9 @@ export default function HeatmapChartFactory(Private) {
squares.append('text')
.text(d => zAxisFormatter(d.y))
.style('display', function () {
.style('display', function (d) {
const textLength = this.getBBox().width;
return textLength > maxLength ? 'none' : 'initial';
return d.hide || textLength > maxLength ? 'none' : 'initial';
})
.style('dominant-baseline', 'central')
.style('text-anchor', 'middle')