Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Commit

Permalink
fix: use SVG renderer for labels (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
tasseKATT authored Jan 15, 2024
1 parent f8656dc commit 61d5148
Show file tree
Hide file tree
Showing 24 changed files with 22 additions and 1 deletion.
2 changes: 2 additions & 0 deletions chart-modules/common/picasso/chart-builder/components/axis.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import extend from 'extend';
import axisDockUtil from './util/axis-dock-util';
import getTextRenderer from './util/get-text-renderer';

function axis(settings, options) {
const chartID = options && options.chartID; // Should we validate if the parameter exists?
Expand All @@ -18,6 +19,7 @@ function axis(settings, options) {
const defaultSettings = {
key: 'axis',
type: 'axis',
renderer: getTextRenderer(options.flags),
dock: axisDockUtil.getAxisDock(direction, dock, isRtl),
brush: { trigger: [], consume: [] },
settings: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import extend from 'extend';
import getTextRenderer from './util/get-text-renderer';

const directions = {
left: 'left',
Expand Down Expand Up @@ -27,9 +28,9 @@ function legend(settings, options) {
const defaultSettings = {
key: 'legend',
type: 'legend-cat',
renderer: getTextRenderer(options.flags),
dock,
show,

scale: {
type: 'color',
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import extend from 'extend';
import getTextRenderer from './util/get-text-renderer';

function getLabel(context) {
const end = context.data.end;
Expand All @@ -15,6 +16,7 @@ function labels(settings, options) {
const defaultSettings = {
key: 'labels',
type: 'labels',
renderer: getTextRenderer(options.flags),
displayOrder: 1,
settings: {
sources: [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default function getTextRenderer(flags) {
if (!flags?.isEnabled?.('IM_5791_SVG_LABEL_RENDERING')) {
return undefined;
}

return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ? undefined : 'svg';
}
1 change: 1 addition & 0 deletions charts/boxplot/src/boxplot-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@ const BoxPlot = ChartView.extend('BoxPlot', {
chartID,
theme,
isRtl,
flags: this.flags,
});

let dimAxisSelectionSettings = {};
Expand Down
1 change: 1 addition & 0 deletions charts/distributionplot/src/distributionplot-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,7 @@ const DistributionPlot = ChartView.extend('DistributionPlot', {
chartID: CONSTANTS.CHART_ID,
theme,
isRtl,
flags: this.flags,
});

if (hyperCube.qStackedDataPages[0].qData.length === 0) {
Expand Down
1 change: 1 addition & 0 deletions charts/histogram/src/chart-settings/chart-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ function createChartSettings(chartView, layout) {
chartID,
theme,
isRtl,
flags: chartView.flags,
});
const themeService = createThemeService({
theme,
Expand Down
1 change: 1 addition & 0 deletions charts/waterfallchart/src/waterfallchart-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ function createChartSettings(layout) {
chartID,
theme,
isRtl,
flags: this.flags,
});
const width = this.picassoElement.clientWidth;
const height = this.picassoElement.clientHeight;
Expand Down
5 changes: 5 additions & 0 deletions nebula.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@ module.exports = {
replacementStrings,
sourcemap: true,
},
serve: {
flags: {
IM_5791_SVG_LABEL_RENDERING: true,
},
},
};
Binary file modified test/rendering/baselines/boxplot-basic-2-baseline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/rendering/baselines/boxplot-basic-4-baseline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/rendering/baselines/distplot-basic-4-baseline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/rendering/baselines/histogram-basic-2-baseline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/rendering/baselines/histogram-basic-3-baseline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/rendering/baselines/histogram-basic-baseline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/rendering/baselines/histogram-theming-global-baseline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/rendering/baselines/histogram-theming-scoped-baseline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/rendering/baselines/waterfall-basic-1-baseline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/rendering/baselines/waterfall-basic-2-baseline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/rendering/baselines/waterfall-basic-3-baseline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/rendering/baselines/waterfall-basic-4-baseline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/rendering/baselines/waterfall-basic-baseline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/rendering/baselines/waterfall-theming-global-baseline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/rendering/baselines/waterfall-theming-scoped-baseline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 61d5148

Please sign in to comment.