Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/superset-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ jobs:
mkdir -p ${{ github.workspace }}/superset-frontend/coverage
docker run \
-v ${{ github.workspace }}/superset-frontend/coverage:/app/superset-frontend/coverage \
-e CI=true \
--rm $TAG \
bash -c \
"npm run test -- --coverage --shard=${{ matrix.shard }}/8 --coverageReporters=json"
Expand Down
12 changes: 12 additions & 0 deletions docs/docs/using-superset/using-ai-with-superset.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,18 @@ Charts are **not saved by default**. The workflow is intentionally iterative:
To skip the preview and save immediately, include "and save it" in your prompt.
:::

:::info Deployment-specific chart types
Use `get_chart_type_schema` before generating a chart to discover the types
available on your Superset instance. Some deployments expose additional
feature-gated visualizations. For example, a deployment with an AG Grid pivot
extension enabled can expose `interactive_pivot`, which supports interactive
row groups, pivot columns, totals, and period-over-period comparisons. Pair
`comparison_period` (for example, `1 year ago`) with `comparison_type`
(`values`, `difference`, `percentage`, or `ratio`). It is distinct from the
built-in `pivot_table` chart type and is not offered when the host visualization
is unavailable.
:::

### Create Dashboards

Build dashboards from a collection of charts:
Expand Down
23 changes: 14 additions & 9 deletions superset-frontend/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@
*/
// timezone for unit tests
process.env.TZ = 'America/New_York';

const reporters = ['default'];

// HTML reporter is not used on CI so skipping its generation for saving time
if (!process.env.CI) {
reporters.push([
'./node_modules/jest-html-reporter',
{
pageTitle: 'Test Report',
},
]);
}

module.exports = {
// [/\\] matches both path separators so the suite also collects on
// native Windows, where jest hands the regex backslash-separated paths.
Expand Down Expand Up @@ -88,14 +101,6 @@ module.exports = {
__DEV__: true,
caches: true,
},
reporters: [
'default',
[
'./node_modules/jest-html-reporter',
{
pageTitle: 'Test Report',
},
],
],
reporters: reporters,
testTimeout: 20000,
};
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import {
CategoricalColorScale,
ChartProps,
NumberFormatter,
TimeGranularity,
getNumberFormatter,
} from '@superset-ui/core';
Expand Down Expand Up @@ -159,6 +160,72 @@ describe('transformSeries', () => {

expect((result as ScatterSeriesOption).symbolSize).toBe(7);
});

test('does not render a per-series stacked label for a zero-value segment (#42702)', () => {
const opts = {
seriesType: EchartsTimeseriesSeriesType.Bar,
stack: true,
onlyTotal: false,
isHorizontal: false,
timeShiftColor: false,
// percentage_threshold defaults to 0, so thresholdValues[dataIndex] is
// 0 too — a value of exactly 0 would satisfy `numericValue >= (thresholdValues[dataIndex] || Number.MIN_SAFE_INTEGER)`
// without the explicit `numericValue !== 0` guard.
thresholdValues: [0],
formatter: new NumberFormatter({
id: 'test-formatter',
formatFunc: (value: number) => `${value}`,
}),
};

const result = transformSeries(series, mockColorScale, 'test-key', opts);
const { formatter: labelFormatter } = (result as any).label;

const zeroValueLabel = labelFormatter({
value: [null, 0],
dataIndex: 0,
seriesIndex: 0,
seriesName: 'test-series',
});
expect(zeroValueLabel).toBe('');

const nonZeroValueLabel = labelFormatter({
value: [null, 32],
dataIndex: 0,
seriesIndex: 0,
seriesName: 'test-series',
});
expect(nonZeroValueLabel).toBe('32');
});

test('still renders a per-series stacked label for a genuine negative value that clears the threshold', () => {
const opts = {
seriesType: EchartsTimeseriesSeriesType.Bar,
stack: true,
onlyTotal: false,
isHorizontal: false,
timeShiftColor: false,
// A category whose stacked total is itself negative produces a
// negative threshold — a strictly-positive check would wrongly
// suppress a real, meaningful negative-value label here.
thresholdValues: [-10],
formatter: new NumberFormatter({
id: 'test-formatter',
formatFunc: (value: number) => `${value}`,
}),
};

const result = transformSeries(series, mockColorScale, 'test-key', opts);
const { formatter: labelFormatter } = (result as any).label;

const negativeValueLabel = labelFormatter({
value: [null, -5],
dataIndex: 0,
seriesIndex: 0,
seriesName: 'test-series',
});
expect(negativeValueLabel).toBe('-5');
});
});

describe('transformNegativeLabelsPosition', () => {
Expand Down
Loading
Loading