Translate vis color schema labels (#23603) (#25107)

Translate color schemas labels
This commit is contained in:
pavel06081991 2018-11-05 16:26:27 +03:00 committed by GitHub
parent c8c8316465
commit fa4e4480ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 2791 additions and 2750 deletions

View file

@ -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

View file

@ -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

View file

@ -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([

View file

@ -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([

View file

@ -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([

View file

@ -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([

View file

@ -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()"

View file

@ -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;

View file

@ -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([

View file

@ -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>

View file

@ -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();

View file

@ -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>

View file

@ -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);
}

View file

@ -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

View file

@ -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');
}

View file

@ -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))
};
}
}