Translate color schemas labels
This commit is contained in:
parent
c8c8316465
commit
fa4e4480ac
|
@ -267,7 +267,7 @@
|
|||
id="colorSchema"
|
||||
class="kuiSelect kuiSideBarSelect"
|
||||
ng-model="editorState.params.gauge.colorSchema"
|
||||
ng-options="mode for mode in collections.colorSchemas"
|
||||
ng-options="mode.id as mode.label for mode in collections.colorSchemas"
|
||||
></select>
|
||||
</div>
|
||||
<div
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
id="colorSchema"
|
||||
class="kuiSelect kuiSideBarSelect"
|
||||
ng-model="editorState.params.colorSchema"
|
||||
ng-options="mode for mode in collections.colorSchemas"
|
||||
ng-options="mode.id as mode.label for mode in collections.colorSchemas"
|
||||
></select>
|
||||
</div>
|
||||
<div
|
||||
|
|
|
@ -85,7 +85,7 @@ export default function GaugeVisType(Private, i18n) {
|
|||
gaugeTypes: ['Arc', 'Circle'],
|
||||
gaugeColorMode: ['None', 'Labels', 'Background'],
|
||||
scales: ['linear', 'log', 'square root'],
|
||||
colorSchemas: Object.keys(vislibColorMaps),
|
||||
colorSchemas: Object.values(vislibColorMaps).map(value => ({ id: value.id, label: value.label })),
|
||||
},
|
||||
optionsTemplate: gaugeTemplate,
|
||||
schemas: new Schemas([
|
||||
|
|
|
@ -81,7 +81,7 @@ export default function GoalVisType(Private, i18n) {
|
|||
gaugeTypes: ['Arc', 'Circle'],
|
||||
gaugeColorMode: ['None', 'Labels', 'Background'],
|
||||
scales: ['linear', 'log', 'square root'],
|
||||
colorSchemas: Object.keys(vislibColorMaps),
|
||||
colorSchemas: Object.values(vislibColorMaps).map(value => ({ id: value.id, label: value.label })),
|
||||
},
|
||||
optionsTemplate: gaugeTemplate,
|
||||
schemas: new Schemas([
|
||||
|
|
|
@ -79,7 +79,7 @@ export default function HeatmapVisType(Private, i18n) {
|
|||
text: 'bottom',
|
||||
}],
|
||||
scales: ['linear', 'log', 'square root'],
|
||||
colorSchemas: Object.keys(vislibColorMaps),
|
||||
colorSchemas: Object.values(vislibColorMaps).map(value => ({ id: value.id, label: value.label })),
|
||||
},
|
||||
optionsTemplate: heatmapTemplate,
|
||||
schemas: new Schemas([
|
||||
|
|
|
@ -86,7 +86,7 @@ function MetricVisProvider(Private, i18n) {
|
|||
label: i18n('metricVis.colorModes.backgroundOptionLabel', { defaultMessage: 'Background' })
|
||||
}
|
||||
],
|
||||
colorSchemas: Object.keys(vislibColorMaps),
|
||||
colorSchemas: Object.values(vislibColorMaps).map(value => ({ id: value.id, label: value.label })),
|
||||
},
|
||||
optionsTemplate: '<metric-vis-params></metric-vis-params>',
|
||||
schemas: new Schemas([
|
||||
|
|
|
@ -187,7 +187,7 @@
|
|||
id="colorSchema"
|
||||
class="kuiSelect kuiSideBarSelect"
|
||||
ng-model="editorState.params.metric.colorSchema"
|
||||
ng-options="mode for mode in collections.colorSchemas"
|
||||
ng-options="mode.id as mode.label for mode in collections.colorSchemas"
|
||||
></select>
|
||||
</div>
|
||||
<div class="text-info text-center" ng-show="customColors" ng-click="resetColors()"
|
||||
|
|
|
@ -74,7 +74,7 @@ export default class ChoroplethLayer extends KibanaMapLayer {
|
|||
|
||||
this._metrics = null;
|
||||
this._joinField = null;
|
||||
this._colorRamp = truncatedColorMaps[Object.keys(truncatedColorMaps)[0]];
|
||||
this._colorRamp = truncatedColorMaps[Object.keys(truncatedColorMaps)[0]].value;
|
||||
this._lineWeight = 1;
|
||||
this._tooltipFormatter = () => '';
|
||||
this._attribution = attribution;
|
||||
|
|
|
@ -76,7 +76,7 @@ provided base maps, or add your own. Darker colors represent higher values.' }),
|
|||
value: 'topright',
|
||||
text: i18n('regionMap.mapVis.regionMapEditorConfig.topRightText', { defaultMessage: 'top right' }),
|
||||
}],
|
||||
colorSchemas: Object.keys(truncatedColorMaps),
|
||||
colorSchemas: Object.values(truncatedColorMaps).map(value => ({ id: value.id, label: value.label })),
|
||||
vectorLayers: vectorLayers
|
||||
},
|
||||
schemas: new Schemas([
|
||||
|
|
|
@ -128,7 +128,7 @@
|
|||
id="colorSchema"
|
||||
class="kuiSelect kuiSideBarSelect"
|
||||
ng-model="editorState.params.colorSchema"
|
||||
ng-options="mode for mode in collections.colorSchemas"
|
||||
ng-options="mode.id as mode.label for mode in collections.colorSchemas"
|
||||
></select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -101,7 +101,7 @@ export function RegionMapsVisualizationProvider(Private, config, i18n) {
|
|||
this._vis.params.showAllShapes
|
||||
);
|
||||
this._choroplethLayer.setJoinField(visParams.selectedJoinField.name);
|
||||
this._choroplethLayer.setColorRamp(truncatedColorMaps[visParams.colorSchema]);
|
||||
this._choroplethLayer.setColorRamp(truncatedColorMaps[visParams.colorSchema].value);
|
||||
this._choroplethLayer.setLineWeight(visParams.outlineWeight);
|
||||
this._setTooltipFormatter();
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
id="colorSchema"
|
||||
class="kuiSelect kuiSideBarSelect"
|
||||
ng-model="editorState.params.colorSchema"
|
||||
ng-options="mode for mode in vis.type.editorConfig.collections.colorSchemas"
|
||||
ng-options="mode.id as mode.label for mode in vis.type.editorConfig.collections.colorSchemas"
|
||||
></select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -214,7 +214,7 @@ export class ScaledCirclesMarkers extends EventEmitter {
|
|||
|
||||
|
||||
function makeLegendColors(colorRampKey) {
|
||||
const colorRamp = truncatedColorMaps[colorRampKey];
|
||||
const colorRamp = _.get(truncatedColorMaps[colorRampKey], 'value');
|
||||
return colorUtil.getLegendColors(colorRamp);
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ VisTypesRegistryProvider.register(function TileMapVisType(Private, getAppState,
|
|||
visualization: CoordinateMapsVisualization,
|
||||
editorConfig: {
|
||||
collections: {
|
||||
colorSchemas: Object.keys(truncatedColorMaps),
|
||||
colorSchemas: Object.values(truncatedColorMaps).map(value => ({ id: value.id, label: value.label })),
|
||||
legendPositions: [{
|
||||
value: 'bottomleft',
|
||||
text: i18n.translate('tileMap.vis.map.editorConfig.legendPositions.bottomLeftText', {
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -60,7 +60,7 @@ export function getHeatmapColors(value, colorSchemaName) {
|
|||
throw new Error('heatmap_color expects a number from 0 to 1 as first parameter');
|
||||
}
|
||||
|
||||
const colorSchema = vislibColorMaps[colorSchemaName];
|
||||
const colorSchema = vislibColorMaps[colorSchemaName].value;
|
||||
if (!colorSchema) {
|
||||
throw new Error('invalid colorSchemaName provided');
|
||||
}
|
||||
|
|
|
@ -25,6 +25,9 @@ const colormaps = vislibColorMaps;
|
|||
for (const key in colormaps) {
|
||||
if (colormaps.hasOwnProperty(key)) {
|
||||
//slice off lightest colors
|
||||
truncatedColorMaps[key] = colormaps[key].slice(Math.floor(colormaps[key].length / 4));
|
||||
truncatedColorMaps[key] = {
|
||||
...colormaps[key],
|
||||
value: colormaps[key].value.slice(Math.floor(colormaps[key].value.length / 4))
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue