refactor: Removes 5.0 approved legacy charts (#31582)
|
|
@ -24,6 +24,7 @@ assists people when migrating to a new version.
|
||||||
|
|
||||||
## Next
|
## Next
|
||||||
|
|
||||||
|
- [31582](https://github.com/apache/superset/pull/31582) Removed the legacy Area, Bar, Event Flow, Heatmap, Histogram, Line, Sankey, and Sankey Loop charts. They were all automatically migrated to their ECharts counterparts with the exception of the Event Flow and Sankey Loop charts which were removed as they were not actively maintained and not widely used. If you were using the Event Flow or Sankey Loop charts, you will need to find an alternative solution.
|
||||||
- [31198](https://github.com/apache/superset/pull/31198) Disallows by default the use of the following ClickHouse functions: "version", "currentDatabase", "hostName".
|
- [31198](https://github.com/apache/superset/pull/31198) Disallows by default the use of the following ClickHouse functions: "version", "currentDatabase", "hostName".
|
||||||
- [29798](https://github.com/apache/superset/pull/29798) Since 3.1.0, the intial schedule for an alert or report was mistakenly offset by the specified timezone's relation to UTC. The initial schedule should now begin at the correct time.
|
- [29798](https://github.com/apache/superset/pull/29798) Since 3.1.0, the intial schedule for an alert or report was mistakenly offset by the specified timezone's relation to UTC. The initial schedule should now begin at the correct time.
|
||||||
- [30021](https://github.com/apache/superset/pull/30021) The `dev` layer in our Dockerfile no long includes firefox binaries, only Chromium to reduce bloat/docker-build-time.
|
- [30021](https://github.com/apache/superset/pull/30021) The `dev` layer in our Dockerfile no long includes firefox binaries, only Chromium to reduce bloat/docker-build-time.
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,10 @@ describe('explore view', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should load Explore', () => {
|
it('should load Explore', () => {
|
||||||
const LINE_CHART_DEFAULTS = { ...FORM_DATA_DEFAULTS, viz_type: 'line' };
|
const LINE_CHART_DEFAULTS = {
|
||||||
|
...FORM_DATA_DEFAULTS,
|
||||||
|
viz_type: 'echarts_timeseries_line',
|
||||||
|
};
|
||||||
const formData = { ...LINE_CHART_DEFAULTS, metrics: [NUM_METRIC] };
|
const formData = { ...LINE_CHART_DEFAULTS, metrics: [NUM_METRIC] };
|
||||||
cy.visitChartByParams(formData);
|
cy.visitChartByParams(formData);
|
||||||
cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' });
|
cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' });
|
||||||
|
|
|
||||||
|
|
@ -524,8 +524,8 @@ describe('Drill by modal', () => {
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Bar Chart V2', () => {
|
it('Bar Chart', () => {
|
||||||
testEchart('echarts_timeseries_bar', 'Bar Chart V2', [
|
testEchart('echarts_timeseries_bar', 'Bar Chart', [
|
||||||
[70, 94],
|
[70, 94],
|
||||||
[362, 68],
|
[362, 68],
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -431,19 +431,6 @@ describe('Drill to detail modal', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Bar Chart', () => {
|
|
||||||
it('opens the modal for unsupported chart without filters', () => {
|
|
||||||
interceptSamples();
|
|
||||||
|
|
||||||
cy.get("[data-test-viz-type='dist_bar'] svg").then($canvas => {
|
|
||||||
cy.wrap($canvas).scrollIntoView();
|
|
||||||
cy.wrap($canvas).rightclick(70, 150);
|
|
||||||
openModalFromChartContext('Drill to detail');
|
|
||||||
cy.getBySel('filter-val').should('not.exist');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Tier 2 charts', () => {
|
describe('Tier 2 charts', () => {
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
import {
|
import { SAMPLE_DASHBOARD_1, TABBED_DASHBOARD } from 'cypress/utils/urls';
|
||||||
SAMPLE_DASHBOARD_1,
|
|
||||||
SUPPORTED_CHARTS_DASHBOARD,
|
|
||||||
TABBED_DASHBOARD,
|
|
||||||
} from 'cypress/utils/urls';
|
|
||||||
import { drag, resize, waitForChartLoad } from 'cypress/utils';
|
import { drag, resize, waitForChartLoad } from 'cypress/utils';
|
||||||
import * as ace from 'brace';
|
import * as ace from 'brace';
|
||||||
import {
|
import {
|
||||||
|
|
@ -30,7 +26,7 @@ import {
|
||||||
openTab,
|
openTab,
|
||||||
} from './utils';
|
} from './utils';
|
||||||
import {
|
import {
|
||||||
interceptExploreJson,
|
interceptV1ChartData,
|
||||||
interceptFiltering as interceptCharts,
|
interceptFiltering as interceptCharts,
|
||||||
} from '../explore/utils';
|
} from '../explore/utils';
|
||||||
|
|
||||||
|
|
@ -55,14 +51,6 @@ function openProperties() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function openExploreProperties() {
|
|
||||||
cy.getBySel('actions-trigger').click({ force: true });
|
|
||||||
cy.get('.ant-dropdown-menu')
|
|
||||||
.contains('Edit chart properties')
|
|
||||||
.click({ force: true });
|
|
||||||
cy.get('.antd5-modal-body').should('be.visible');
|
|
||||||
}
|
|
||||||
|
|
||||||
function assertMetadata(text: string) {
|
function assertMetadata(text: string) {
|
||||||
const regex = new RegExp(text);
|
const regex = new RegExp(text);
|
||||||
cy.get('#json_metadata')
|
cy.get('#json_metadata')
|
||||||
|
|
@ -225,7 +213,7 @@ function writeMetadata(metadata: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function openExploreWithDashboardContext(chartName: string) {
|
function openExploreWithDashboardContext(chartName: string) {
|
||||||
interceptExploreJson();
|
interceptV1ChartData();
|
||||||
interceptGet();
|
interceptGet();
|
||||||
|
|
||||||
cy.get(
|
cy.get(
|
||||||
|
|
@ -237,7 +225,7 @@ function openExploreWithDashboardContext(chartName: string) {
|
||||||
.eq(2)
|
.eq(2)
|
||||||
.should('contain', 'Edit chart')
|
.should('contain', 'Edit chart')
|
||||||
.click();
|
.click();
|
||||||
cy.wait('@getJson');
|
cy.wait('@v1Data');
|
||||||
cy.get('.chart-container').should('exist');
|
cy.get('.chart-container').should('exist');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -255,13 +243,16 @@ function saveExploreColorScheme(
|
||||||
cy.wait('@chartUpdate');
|
cy.wait('@chartUpdate');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: Skipping some tests as ECharts are rendered using Canvas and we cannot inspect the elements
|
||||||
|
// to verify the colors. We should revisit these tests once we have a solution to verify ECharts.
|
||||||
|
|
||||||
describe('Dashboard edit', () => {
|
describe('Dashboard edit', () => {
|
||||||
describe('Color consistency', () => {
|
describe('Color consistency', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
resetDashboardColors();
|
resetDashboardColors();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not allow to change color scheme of a chart when dashboard has one', () => {
|
it.skip('should not allow to change color scheme of a chart when dashboard has one', () => {
|
||||||
visitEdit(TABBED_DASHBOARD);
|
visitEdit(TABBED_DASHBOARD);
|
||||||
openProperties();
|
openProperties();
|
||||||
selectColorScheme('blueToGreen');
|
selectColorScheme('blueToGreen');
|
||||||
|
|
@ -272,11 +263,14 @@ describe('Dashboard edit', () => {
|
||||||
openTab(1, 1);
|
openTab(1, 1);
|
||||||
waitForChartLoad({
|
waitForChartLoad({
|
||||||
name: 'Top 10 California Names Timeseries',
|
name: 'Top 10 California Names Timeseries',
|
||||||
viz: 'line',
|
viz: 'echarts_timeseries_line',
|
||||||
});
|
});
|
||||||
|
|
||||||
openExploreWithDashboardContext('Top 10 California Names Timeseries');
|
openExploreWithDashboardContext('Top 10 California Names Timeseries');
|
||||||
|
|
||||||
|
// hover over canvas elements
|
||||||
|
cy.get('canvas').trigger('mouseover', { force: true });
|
||||||
|
|
||||||
// label Anthony
|
// label Anthony
|
||||||
cy.get('[data-test="chart-container"] .line .nv-legend-symbol')
|
cy.get('[data-test="chart-container"] .line .nv-legend-symbol')
|
||||||
.first()
|
.first()
|
||||||
|
|
@ -287,21 +281,21 @@ describe('Dashboard edit', () => {
|
||||||
cy.get('[aria-label="Select color scheme"]').should('be.disabled');
|
cy.get('[aria-label="Select color scheme"]').should('be.disabled');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not allow to change color scheme of a chart when dashboard has no scheme but chart has shared labels', () => {
|
it.skip('should not allow to change color scheme of a chart when dashboard has no scheme but chart has shared labels', () => {
|
||||||
visit(TABBED_DASHBOARD);
|
visit(TABBED_DASHBOARD);
|
||||||
|
|
||||||
// open nested tab
|
// open nested tab
|
||||||
openTab(1, 1);
|
openTab(1, 1);
|
||||||
waitForChartLoad({
|
waitForChartLoad({
|
||||||
name: 'Top 10 California Names Timeseries',
|
name: 'Top 10 California Names Timeseries',
|
||||||
viz: 'line',
|
viz: 'echarts_timeseries_line',
|
||||||
});
|
});
|
||||||
|
|
||||||
// open second top tab to catch shared labels
|
// open second top tab to catch shared labels
|
||||||
openTab(0, 1);
|
openTab(0, 1);
|
||||||
waitForChartLoad({
|
waitForChartLoad({
|
||||||
name: 'Trends',
|
name: 'Trends',
|
||||||
viz: 'line',
|
viz: 'echarts_timeseries_line',
|
||||||
});
|
});
|
||||||
|
|
||||||
openTab(0, 0);
|
openTab(0, 0);
|
||||||
|
|
@ -317,7 +311,7 @@ describe('Dashboard edit', () => {
|
||||||
cy.get('[aria-label="Select color scheme"]').should('be.disabled');
|
cy.get('[aria-label="Select color scheme"]').should('be.disabled');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should allow to change color scheme of a chart when dashboard has no scheme but only custom label colors', () => {
|
it.skip('should allow to change color scheme of a chart when dashboard has no scheme but only custom label colors', () => {
|
||||||
visitEdit(TABBED_DASHBOARD);
|
visitEdit(TABBED_DASHBOARD);
|
||||||
openProperties();
|
openProperties();
|
||||||
openAdvancedProperties();
|
openAdvancedProperties();
|
||||||
|
|
@ -330,7 +324,7 @@ describe('Dashboard edit', () => {
|
||||||
openTab(1, 1);
|
openTab(1, 1);
|
||||||
waitForChartLoad({
|
waitForChartLoad({
|
||||||
name: 'Top 10 California Names Timeseries',
|
name: 'Top 10 California Names Timeseries',
|
||||||
viz: 'line',
|
viz: 'echarts_timeseries_line',
|
||||||
});
|
});
|
||||||
|
|
||||||
// label Anthony
|
// label Anthony
|
||||||
|
|
@ -371,14 +365,14 @@ describe('Dashboard edit', () => {
|
||||||
.should('have.css', 'fill', 'rgb(0, 116, 241)');
|
.should('have.css', 'fill', 'rgb(0, 116, 241)');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should allow to change color scheme of a chart when dashboard has no scheme and show the change', () => {
|
it.skip('should allow to change color scheme of a chart when dashboard has no scheme and show the change', () => {
|
||||||
visit(TABBED_DASHBOARD);
|
visit(TABBED_DASHBOARD);
|
||||||
|
|
||||||
// open nested tab
|
// open nested tab
|
||||||
openTab(1, 1);
|
openTab(1, 1);
|
||||||
waitForChartLoad({
|
waitForChartLoad({
|
||||||
name: 'Top 10 California Names Timeseries',
|
name: 'Top 10 California Names Timeseries',
|
||||||
viz: 'line',
|
viz: 'echarts_timeseries_line',
|
||||||
});
|
});
|
||||||
|
|
||||||
// label Anthony
|
// label Anthony
|
||||||
|
|
@ -414,7 +408,7 @@ describe('Dashboard edit', () => {
|
||||||
saveExploreColorScheme();
|
saveExploreColorScheme();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should allow to change color scheme of a chart when dashboard has no scheme but custom label colors and show the change', () => {
|
it.skip('should allow to change color scheme of a chart when dashboard has no scheme but custom label colors and show the change', () => {
|
||||||
visitEdit(TABBED_DASHBOARD);
|
visitEdit(TABBED_DASHBOARD);
|
||||||
openProperties();
|
openProperties();
|
||||||
openAdvancedProperties();
|
openAdvancedProperties();
|
||||||
|
|
@ -427,7 +421,7 @@ describe('Dashboard edit', () => {
|
||||||
openTab(1, 1);
|
openTab(1, 1);
|
||||||
waitForChartLoad({
|
waitForChartLoad({
|
||||||
name: 'Top 10 California Names Timeseries',
|
name: 'Top 10 California Names Timeseries',
|
||||||
viz: 'line',
|
viz: 'echarts_timeseries_line',
|
||||||
});
|
});
|
||||||
|
|
||||||
// label Anthony
|
// label Anthony
|
||||||
|
|
@ -473,14 +467,14 @@ describe('Dashboard edit', () => {
|
||||||
saveExploreColorScheme();
|
saveExploreColorScheme();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not change colors on refreshes with no color scheme set', () => {
|
it.skip('should not change colors on refreshes with no color scheme set', () => {
|
||||||
visit(TABBED_DASHBOARD);
|
visit(TABBED_DASHBOARD);
|
||||||
|
|
||||||
// open nested tab
|
// open nested tab
|
||||||
openTab(1, 1);
|
openTab(1, 1);
|
||||||
waitForChartLoad({
|
waitForChartLoad({
|
||||||
name: 'Top 10 California Names Timeseries',
|
name: 'Top 10 California Names Timeseries',
|
||||||
viz: 'line',
|
viz: 'echarts_timeseries_line',
|
||||||
});
|
});
|
||||||
|
|
||||||
// label Anthony
|
// label Anthony
|
||||||
|
|
@ -492,7 +486,7 @@ describe('Dashboard edit', () => {
|
||||||
|
|
||||||
// open 2nd main tab
|
// open 2nd main tab
|
||||||
openTab(0, 1);
|
openTab(0, 1);
|
||||||
waitForChartLoad({ name: 'Trends', viz: 'line' });
|
waitForChartLoad({ name: 'Trends', viz: 'echarts_timeseries_line' });
|
||||||
|
|
||||||
// label Andrew
|
// label Andrew
|
||||||
cy.get('[data-test-chart-name="Trends"] .line .nv-legend-symbol')
|
cy.get('[data-test-chart-name="Trends"] .line .nv-legend-symbol')
|
||||||
|
|
@ -505,7 +499,7 @@ describe('Dashboard edit', () => {
|
||||||
openTab(1, 1);
|
openTab(1, 1);
|
||||||
waitForChartLoad({
|
waitForChartLoad({
|
||||||
name: 'Top 10 California Names Timeseries',
|
name: 'Top 10 California Names Timeseries',
|
||||||
viz: 'line',
|
viz: 'echarts_timeseries_line',
|
||||||
});
|
});
|
||||||
|
|
||||||
// label Anthony
|
// label Anthony
|
||||||
|
|
@ -517,7 +511,7 @@ describe('Dashboard edit', () => {
|
||||||
|
|
||||||
// open 2nd main tab
|
// open 2nd main tab
|
||||||
openTab(0, 1);
|
openTab(0, 1);
|
||||||
waitForChartLoad({ name: 'Trends', viz: 'line' });
|
waitForChartLoad({ name: 'Trends', viz: 'echarts_timeseries_line' });
|
||||||
|
|
||||||
// label Andrew
|
// label Andrew
|
||||||
cy.get('[data-test-chart-name="Trends"] .line .nv-legend-symbol')
|
cy.get('[data-test-chart-name="Trends"] .line .nv-legend-symbol')
|
||||||
|
|
@ -525,7 +519,7 @@ describe('Dashboard edit', () => {
|
||||||
.should('have.css', 'fill', 'rgb(69, 78, 124)');
|
.should('have.css', 'fill', 'rgb(69, 78, 124)');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not change colors on refreshes with color scheme set', () => {
|
it.skip('should not change colors on refreshes with color scheme set', () => {
|
||||||
visitEdit(TABBED_DASHBOARD);
|
visitEdit(TABBED_DASHBOARD);
|
||||||
openProperties();
|
openProperties();
|
||||||
selectColorScheme('blueToGreen');
|
selectColorScheme('blueToGreen');
|
||||||
|
|
@ -536,7 +530,7 @@ describe('Dashboard edit', () => {
|
||||||
openTab(1, 1);
|
openTab(1, 1);
|
||||||
waitForChartLoad({
|
waitForChartLoad({
|
||||||
name: 'Top 10 California Names Timeseries',
|
name: 'Top 10 California Names Timeseries',
|
||||||
viz: 'line',
|
viz: 'echarts_timeseries_line',
|
||||||
});
|
});
|
||||||
|
|
||||||
// label Anthony
|
// label Anthony
|
||||||
|
|
@ -548,7 +542,7 @@ describe('Dashboard edit', () => {
|
||||||
|
|
||||||
// open 2nd main tab
|
// open 2nd main tab
|
||||||
openTab(0, 1);
|
openTab(0, 1);
|
||||||
waitForChartLoad({ name: 'Trends', viz: 'line' });
|
waitForChartLoad({ name: 'Trends', viz: 'echarts_timeseries_line' });
|
||||||
|
|
||||||
// label Andrew
|
// label Andrew
|
||||||
cy.get('[data-test-chart-name="Trends"] .line .nv-legend-symbol')
|
cy.get('[data-test-chart-name="Trends"] .line .nv-legend-symbol')
|
||||||
|
|
@ -561,7 +555,7 @@ describe('Dashboard edit', () => {
|
||||||
openTab(1, 1);
|
openTab(1, 1);
|
||||||
waitForChartLoad({
|
waitForChartLoad({
|
||||||
name: 'Top 10 California Names Timeseries',
|
name: 'Top 10 California Names Timeseries',
|
||||||
viz: 'line',
|
viz: 'echarts_timeseries_line',
|
||||||
});
|
});
|
||||||
|
|
||||||
// label Anthony
|
// label Anthony
|
||||||
|
|
@ -573,7 +567,7 @@ describe('Dashboard edit', () => {
|
||||||
|
|
||||||
// open 2nd main tab
|
// open 2nd main tab
|
||||||
openTab(0, 1);
|
openTab(0, 1);
|
||||||
waitForChartLoad({ name: 'Trends', viz: 'line' });
|
waitForChartLoad({ name: 'Trends', viz: 'echarts_timeseries_line' });
|
||||||
|
|
||||||
// label Andrew
|
// label Andrew
|
||||||
cy.get('[data-test-chart-name="Trends"] .line .nv-legend-symbol')
|
cy.get('[data-test-chart-name="Trends"] .line .nv-legend-symbol')
|
||||||
|
|
@ -581,14 +575,14 @@ describe('Dashboard edit', () => {
|
||||||
.should('have.css', 'fill', 'rgb(0, 76, 218)');
|
.should('have.css', 'fill', 'rgb(0, 76, 218)');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should respect chart color scheme when none is set for the dashboard', () => {
|
it.skip('should respect chart color scheme when none is set for the dashboard', () => {
|
||||||
visit(TABBED_DASHBOARD);
|
visit(TABBED_DASHBOARD);
|
||||||
|
|
||||||
// open nested tab
|
// open nested tab
|
||||||
openTab(1, 1);
|
openTab(1, 1);
|
||||||
waitForChartLoad({
|
waitForChartLoad({
|
||||||
name: 'Top 10 California Names Timeseries',
|
name: 'Top 10 California Names Timeseries',
|
||||||
viz: 'line',
|
viz: 'echarts_timeseries_line',
|
||||||
});
|
});
|
||||||
|
|
||||||
// label Anthony
|
// label Anthony
|
||||||
|
|
@ -599,7 +593,7 @@ describe('Dashboard edit', () => {
|
||||||
.should('have.css', 'fill', 'rgb(31, 168, 201)');
|
.should('have.css', 'fill', 'rgb(31, 168, 201)');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should apply same color to same labels with color scheme set on refresh', () => {
|
it.skip('should apply same color to same labels with color scheme set on refresh', () => {
|
||||||
visitEdit(TABBED_DASHBOARD);
|
visitEdit(TABBED_DASHBOARD);
|
||||||
openProperties();
|
openProperties();
|
||||||
selectColorScheme('blueToGreen');
|
selectColorScheme('blueToGreen');
|
||||||
|
|
@ -610,7 +604,7 @@ describe('Dashboard edit', () => {
|
||||||
openTab(1, 1);
|
openTab(1, 1);
|
||||||
waitForChartLoad({
|
waitForChartLoad({
|
||||||
name: 'Top 10 California Names Timeseries',
|
name: 'Top 10 California Names Timeseries',
|
||||||
viz: 'line',
|
viz: 'echarts_timeseries_line',
|
||||||
});
|
});
|
||||||
|
|
||||||
// label Anthony
|
// label Anthony
|
||||||
|
|
@ -622,7 +616,7 @@ describe('Dashboard edit', () => {
|
||||||
|
|
||||||
// open 2nd main tab
|
// open 2nd main tab
|
||||||
openTab(0, 1);
|
openTab(0, 1);
|
||||||
waitForChartLoad({ name: 'Trends', viz: 'line' });
|
waitForChartLoad({ name: 'Trends', viz: 'echarts_timeseries_line' });
|
||||||
|
|
||||||
// label Anthony
|
// label Anthony
|
||||||
cy.get('[data-test-chart-name="Trends"] .line .nv-legend-symbol')
|
cy.get('[data-test-chart-name="Trends"] .line .nv-legend-symbol')
|
||||||
|
|
@ -634,7 +628,7 @@ describe('Dashboard edit', () => {
|
||||||
openTab(1, 1);
|
openTab(1, 1);
|
||||||
waitForChartLoad({
|
waitForChartLoad({
|
||||||
name: 'Top 10 California Names Timeseries',
|
name: 'Top 10 California Names Timeseries',
|
||||||
viz: 'line',
|
viz: 'echarts_timeseries_line',
|
||||||
});
|
});
|
||||||
|
|
||||||
// label Anthony
|
// label Anthony
|
||||||
|
|
@ -646,7 +640,7 @@ describe('Dashboard edit', () => {
|
||||||
|
|
||||||
// open 2nd main tab
|
// open 2nd main tab
|
||||||
openTab(0, 1);
|
openTab(0, 1);
|
||||||
waitForChartLoad({ name: 'Trends', viz: 'line' });
|
waitForChartLoad({ name: 'Trends', viz: 'echarts_timeseries_line' });
|
||||||
|
|
||||||
// label Anthony
|
// label Anthony
|
||||||
cy.get('[data-test-chart-name="Trends"] .line .nv-legend-symbol')
|
cy.get('[data-test-chart-name="Trends"] .line .nv-legend-symbol')
|
||||||
|
|
@ -654,14 +648,14 @@ describe('Dashboard edit', () => {
|
||||||
.should('have.css', 'fill', 'rgb(50, 0, 167)');
|
.should('have.css', 'fill', 'rgb(50, 0, 167)');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should apply same color to same labels with no color scheme set on refresh', () => {
|
it.skip('should apply same color to same labels with no color scheme set on refresh', () => {
|
||||||
visit(TABBED_DASHBOARD);
|
visit(TABBED_DASHBOARD);
|
||||||
|
|
||||||
// open nested tab
|
// open nested tab
|
||||||
openTab(1, 1);
|
openTab(1, 1);
|
||||||
waitForChartLoad({
|
waitForChartLoad({
|
||||||
name: 'Top 10 California Names Timeseries',
|
name: 'Top 10 California Names Timeseries',
|
||||||
viz: 'line',
|
viz: 'echarts_timeseries_line',
|
||||||
});
|
});
|
||||||
|
|
||||||
// label Anthony
|
// label Anthony
|
||||||
|
|
@ -673,7 +667,7 @@ describe('Dashboard edit', () => {
|
||||||
|
|
||||||
// open 2nd main tab
|
// open 2nd main tab
|
||||||
openTab(0, 1);
|
openTab(0, 1);
|
||||||
waitForChartLoad({ name: 'Trends', viz: 'line' });
|
waitForChartLoad({ name: 'Trends', viz: 'echarts_timeseries_line' });
|
||||||
|
|
||||||
// label Anthony
|
// label Anthony
|
||||||
cy.get('[data-test-chart-name="Trends"] .line .nv-legend-symbol')
|
cy.get('[data-test-chart-name="Trends"] .line .nv-legend-symbol')
|
||||||
|
|
@ -686,7 +680,7 @@ describe('Dashboard edit', () => {
|
||||||
openTab(1, 1);
|
openTab(1, 1);
|
||||||
waitForChartLoad({
|
waitForChartLoad({
|
||||||
name: 'Top 10 California Names Timeseries',
|
name: 'Top 10 California Names Timeseries',
|
||||||
viz: 'line',
|
viz: 'echarts_timeseries_line',
|
||||||
});
|
});
|
||||||
|
|
||||||
// label Anthony
|
// label Anthony
|
||||||
|
|
@ -698,7 +692,7 @@ describe('Dashboard edit', () => {
|
||||||
|
|
||||||
// open 2nd main tab
|
// open 2nd main tab
|
||||||
openTab(0, 1);
|
openTab(0, 1);
|
||||||
waitForChartLoad({ name: 'Trends', viz: 'line' });
|
waitForChartLoad({ name: 'Trends', viz: 'echarts_timeseries_line' });
|
||||||
|
|
||||||
// label Anthony
|
// label Anthony
|
||||||
cy.get('[data-test-chart-name="Trends"] .line .nv-legend-symbol')
|
cy.get('[data-test-chart-name="Trends"] .line .nv-legend-symbol')
|
||||||
|
|
@ -706,7 +700,7 @@ describe('Dashboard edit', () => {
|
||||||
.should('have.css', 'fill', 'rgb(31, 168, 201)');
|
.should('have.css', 'fill', 'rgb(31, 168, 201)');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('custom label colors should take the precedence in nested tabs', () => {
|
it.skip('custom label colors should take the precedence in nested tabs', () => {
|
||||||
visitEdit(TABBED_DASHBOARD);
|
visitEdit(TABBED_DASHBOARD);
|
||||||
openProperties();
|
openProperties();
|
||||||
openAdvancedProperties();
|
openAdvancedProperties();
|
||||||
|
|
@ -721,7 +715,7 @@ describe('Dashboard edit', () => {
|
||||||
openTab(1, 1);
|
openTab(1, 1);
|
||||||
waitForChartLoad({
|
waitForChartLoad({
|
||||||
name: 'Top 10 California Names Timeseries',
|
name: 'Top 10 California Names Timeseries',
|
||||||
viz: 'line',
|
viz: 'echarts_timeseries_line',
|
||||||
});
|
});
|
||||||
cy.get(
|
cy.get(
|
||||||
'[data-test-chart-name="Top 10 California Names Timeseries"] .line .nv-legend-symbol',
|
'[data-test-chart-name="Top 10 California Names Timeseries"] .line .nv-legend-symbol',
|
||||||
|
|
@ -731,19 +725,19 @@ describe('Dashboard edit', () => {
|
||||||
|
|
||||||
// open another nested tab
|
// open another nested tab
|
||||||
openTab(2, 1);
|
openTab(2, 1);
|
||||||
waitForChartLoad({ name: 'Growth Rate', viz: 'line' });
|
waitForChartLoad({ name: 'Growth Rate', viz: 'echarts_timeseries_line' });
|
||||||
cy.get('[data-test-chart-name="Growth Rate"] .line .nv-legend-symbol')
|
cy.get('[data-test-chart-name="Growth Rate"] .line .nv-legend-symbol')
|
||||||
.first()
|
.first()
|
||||||
.should('have.css', 'fill', 'rgb(255, 0, 0)');
|
.should('have.css', 'fill', 'rgb(255, 0, 0)');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('label colors should take the precedence for rendered charts in nested tabs', () => {
|
it.skip('label colors should take the precedence for rendered charts in nested tabs', () => {
|
||||||
visitEdit(TABBED_DASHBOARD);
|
visitEdit(TABBED_DASHBOARD);
|
||||||
// open the tab first time and let chart load
|
// open the tab first time and let chart load
|
||||||
openTab(1, 1);
|
openTab(1, 1);
|
||||||
waitForChartLoad({
|
waitForChartLoad({
|
||||||
name: 'Top 10 California Names Timeseries',
|
name: 'Top 10 California Names Timeseries',
|
||||||
viz: 'line',
|
viz: 'echarts_timeseries_line',
|
||||||
});
|
});
|
||||||
|
|
||||||
// go to previous tab
|
// go to previous tab
|
||||||
|
|
@ -766,7 +760,7 @@ describe('Dashboard edit', () => {
|
||||||
.should('have.css', 'fill', 'rgb(255, 0, 0)');
|
.should('have.css', 'fill', 'rgb(255, 0, 0)');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should re-apply original color after removing custom label color with color scheme set', () => {
|
it.skip('should re-apply original color after removing custom label color with color scheme set', () => {
|
||||||
visitEdit(TABBED_DASHBOARD);
|
visitEdit(TABBED_DASHBOARD);
|
||||||
openProperties();
|
openProperties();
|
||||||
openAdvancedProperties();
|
openAdvancedProperties();
|
||||||
|
|
@ -809,13 +803,13 @@ describe('Dashboard edit', () => {
|
||||||
.should('have.css', 'fill', 'rgb(41, 171, 226)');
|
.should('have.css', 'fill', 'rgb(41, 171, 226)');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should re-apply original color after removing custom label color with no color scheme set', () => {
|
it.skip('should re-apply original color after removing custom label color with no color scheme set', () => {
|
||||||
visitEdit(TABBED_DASHBOARD);
|
visitEdit(TABBED_DASHBOARD);
|
||||||
// open nested tab
|
// open nested tab
|
||||||
openTab(1, 1);
|
openTab(1, 1);
|
||||||
waitForChartLoad({
|
waitForChartLoad({
|
||||||
name: 'Top 10 California Names Timeseries',
|
name: 'Top 10 California Names Timeseries',
|
||||||
viz: 'line',
|
viz: 'echarts_timeseries_line',
|
||||||
});
|
});
|
||||||
cy.get(
|
cy.get(
|
||||||
'[data-test-chart-name="Top 10 California Names Timeseries"] .line .nv-legend-symbol',
|
'[data-test-chart-name="Top 10 California Names Timeseries"] .line .nv-legend-symbol',
|
||||||
|
|
@ -873,7 +867,7 @@ describe('Dashboard edit', () => {
|
||||||
.should('have.css', 'fill', 'rgb(90, 193, 137)');
|
.should('have.css', 'fill', 'rgb(90, 193, 137)');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should show the same colors in Explore', () => {
|
it.skip('should show the same colors in Explore', () => {
|
||||||
visitEdit(TABBED_DASHBOARD);
|
visitEdit(TABBED_DASHBOARD);
|
||||||
openProperties();
|
openProperties();
|
||||||
openAdvancedProperties();
|
openAdvancedProperties();
|
||||||
|
|
@ -888,7 +882,7 @@ describe('Dashboard edit', () => {
|
||||||
openTab(1, 1);
|
openTab(1, 1);
|
||||||
waitForChartLoad({
|
waitForChartLoad({
|
||||||
name: 'Top 10 California Names Timeseries',
|
name: 'Top 10 California Names Timeseries',
|
||||||
viz: 'line',
|
viz: 'echarts_timeseries_line',
|
||||||
});
|
});
|
||||||
|
|
||||||
// label Anthony
|
// label Anthony
|
||||||
|
|
@ -906,7 +900,7 @@ describe('Dashboard edit', () => {
|
||||||
.should('have.css', 'fill', 'rgb(255, 0, 0)');
|
.should('have.css', 'fill', 'rgb(255, 0, 0)');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should change color scheme multiple times', () => {
|
it.skip('should change color scheme multiple times', () => {
|
||||||
visitEdit(TABBED_DASHBOARD);
|
visitEdit(TABBED_DASHBOARD);
|
||||||
openProperties();
|
openProperties();
|
||||||
selectColorScheme('blueToGreen');
|
selectColorScheme('blueToGreen');
|
||||||
|
|
@ -917,7 +911,7 @@ describe('Dashboard edit', () => {
|
||||||
openTab(1, 1);
|
openTab(1, 1);
|
||||||
waitForChartLoad({
|
waitForChartLoad({
|
||||||
name: 'Top 10 California Names Timeseries',
|
name: 'Top 10 California Names Timeseries',
|
||||||
viz: 'line',
|
viz: 'echarts_timeseries_line',
|
||||||
});
|
});
|
||||||
|
|
||||||
// label Anthony
|
// label Anthony
|
||||||
|
|
@ -929,7 +923,7 @@ describe('Dashboard edit', () => {
|
||||||
|
|
||||||
// open 2nd main tab
|
// open 2nd main tab
|
||||||
openTab(0, 1);
|
openTab(0, 1);
|
||||||
waitForChartLoad({ name: 'Trends', viz: 'line' });
|
waitForChartLoad({ name: 'Trends', viz: 'echarts_timeseries_line' });
|
||||||
|
|
||||||
// label Anthony
|
// label Anthony
|
||||||
cy.get('[data-test-chart-name="Trends"] .line .nv-legend-symbol')
|
cy.get('[data-test-chart-name="Trends"] .line .nv-legend-symbol')
|
||||||
|
|
@ -959,7 +953,7 @@ describe('Dashboard edit', () => {
|
||||||
.should('have.css', 'fill', 'rgb(0, 128, 246)');
|
.should('have.css', 'fill', 'rgb(0, 128, 246)');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should apply the color scheme across main tabs', () => {
|
it.skip('should apply the color scheme across main tabs', () => {
|
||||||
visitEdit(TABBED_DASHBOARD);
|
visitEdit(TABBED_DASHBOARD);
|
||||||
openProperties();
|
openProperties();
|
||||||
selectColorScheme('blueToGreen');
|
selectColorScheme('blueToGreen');
|
||||||
|
|
@ -968,14 +962,14 @@ describe('Dashboard edit', () => {
|
||||||
|
|
||||||
// go to second tab
|
// go to second tab
|
||||||
openTab(0, 1);
|
openTab(0, 1);
|
||||||
waitForChartLoad({ name: 'Trends', viz: 'line' });
|
waitForChartLoad({ name: 'Trends', viz: 'echarts_timeseries_line' });
|
||||||
|
|
||||||
cy.get('[data-test-chart-name="Trends"] .line .nv-legend-symbol')
|
cy.get('[data-test-chart-name="Trends"] .line .nv-legend-symbol')
|
||||||
.first()
|
.first()
|
||||||
.should('have.css', 'fill', 'rgb(50, 0, 167)');
|
.should('have.css', 'fill', 'rgb(50, 0, 167)');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should apply the color scheme across main tabs for rendered charts', () => {
|
it.skip('should apply the color scheme across main tabs for rendered charts', () => {
|
||||||
visitEdit(TABBED_DASHBOARD);
|
visitEdit(TABBED_DASHBOARD);
|
||||||
waitForChartLoad({ name: 'Treemap', viz: 'treemap_v2' });
|
waitForChartLoad({ name: 'Treemap', viz: 'treemap_v2' });
|
||||||
openProperties();
|
openProperties();
|
||||||
|
|
@ -985,7 +979,7 @@ describe('Dashboard edit', () => {
|
||||||
|
|
||||||
// go to second tab
|
// go to second tab
|
||||||
openTab(0, 1);
|
openTab(0, 1);
|
||||||
waitForChartLoad({ name: 'Trends', viz: 'line' });
|
waitForChartLoad({ name: 'Trends', viz: 'echarts_timeseries_line' });
|
||||||
|
|
||||||
cy.get('[data-test-chart-name="Trends"] .line .nv-legend-symbol')
|
cy.get('[data-test-chart-name="Trends"] .line .nv-legend-symbol')
|
||||||
.first()
|
.first()
|
||||||
|
|
@ -1003,7 +997,7 @@ describe('Dashboard edit', () => {
|
||||||
.should('have.css', 'fill', 'rgb(0, 128, 246)');
|
.should('have.css', 'fill', 'rgb(0, 128, 246)');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should apply the color scheme in nested tabs', () => {
|
it.skip('should apply the color scheme in nested tabs', () => {
|
||||||
visitEdit(TABBED_DASHBOARD);
|
visitEdit(TABBED_DASHBOARD);
|
||||||
openProperties();
|
openProperties();
|
||||||
selectColorScheme('blueToGreen');
|
selectColorScheme('blueToGreen');
|
||||||
|
|
@ -1014,7 +1008,7 @@ describe('Dashboard edit', () => {
|
||||||
openTab(1, 1);
|
openTab(1, 1);
|
||||||
waitForChartLoad({
|
waitForChartLoad({
|
||||||
name: 'Top 10 California Names Timeseries',
|
name: 'Top 10 California Names Timeseries',
|
||||||
viz: 'line',
|
viz: 'echarts_timeseries_line',
|
||||||
});
|
});
|
||||||
cy.get(
|
cy.get(
|
||||||
'[data-test-chart-name="Top 10 California Names Timeseries"] .line .nv-legend-symbol',
|
'[data-test-chart-name="Top 10 California Names Timeseries"] .line .nv-legend-symbol',
|
||||||
|
|
@ -1024,19 +1018,19 @@ describe('Dashboard edit', () => {
|
||||||
|
|
||||||
// open another nested tab
|
// open another nested tab
|
||||||
openTab(2, 1);
|
openTab(2, 1);
|
||||||
waitForChartLoad({ name: 'Growth Rate', viz: 'line' });
|
waitForChartLoad({ name: 'Growth Rate', viz: 'echarts_timeseries_line' });
|
||||||
cy.get('[data-test-chart-name="Growth Rate"] .line .nv-legend-symbol')
|
cy.get('[data-test-chart-name="Growth Rate"] .line .nv-legend-symbol')
|
||||||
.first()
|
.first()
|
||||||
.should('have.css', 'fill', 'rgb(50, 0, 167)');
|
.should('have.css', 'fill', 'rgb(50, 0, 167)');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should apply a valid color scheme for rendered charts in nested tabs', () => {
|
it.skip('should apply a valid color scheme for rendered charts in nested tabs', () => {
|
||||||
visitEdit(TABBED_DASHBOARD);
|
visitEdit(TABBED_DASHBOARD);
|
||||||
// open the tab first time and let chart load
|
// open the tab first time and let chart load
|
||||||
openTab(1, 1);
|
openTab(1, 1);
|
||||||
waitForChartLoad({
|
waitForChartLoad({
|
||||||
name: 'Top 10 California Names Timeseries',
|
name: 'Top 10 California Names Timeseries',
|
||||||
viz: 'line',
|
viz: 'echarts_timeseries_line',
|
||||||
});
|
});
|
||||||
|
|
||||||
// go to previous tab
|
// go to previous tab
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ import { TABBED_DASHBOARD } from 'cypress/utils/urls';
|
||||||
import { expandFilterOnLeftPanel } from './utils';
|
import { expandFilterOnLeftPanel } from './utils';
|
||||||
|
|
||||||
const TREEMAP = { name: 'Treemap', viz: 'treemap_v2' };
|
const TREEMAP = { name: 'Treemap', viz: 'treemap_v2' };
|
||||||
const LINE_CHART = { name: 'Growth Rate', viz: 'line' };
|
const LINE_CHART = { name: 'Growth Rate', viz: 'echarts_timeseries_line' };
|
||||||
const BOX_PLOT = { name: 'Box plot', viz: 'box_plot' };
|
const BOX_PLOT = { name: 'Box plot', viz: 'box_plot' };
|
||||||
const BIG_NUMBER = { name: 'Number of Girls', viz: 'big_number_total' };
|
const BIG_NUMBER = { name: 'Number of Girls', viz: 'big_number_total' };
|
||||||
const TABLE = { name: 'Names Sorted by Num in California', viz: 'table' };
|
const TABLE = { name: 'Names Sorted by Num in California', viz: 'table' };
|
||||||
|
|
@ -64,9 +64,8 @@ describe('Dashboard tabs', () => {
|
||||||
cy.get('@top-level-tabs')
|
cy.get('@top-level-tabs')
|
||||||
.last()
|
.last()
|
||||||
.should('not.have.class', 'ant-tabs-tab-active');
|
.should('not.have.class', 'ant-tabs-tab-active');
|
||||||
|
cy.get('[data-test-chart-name="Box plot"]').should('not.exist');
|
||||||
cy.getBySel('grid-container').find('.box_plot').should('not.exist');
|
cy.get('[data-test-chart-name="Trends"]').should('not.exist');
|
||||||
cy.getBySel('grid-container').find('.line').should('not.exist');
|
|
||||||
|
|
||||||
cy.get('@top-level-tabs').last().click();
|
cy.get('@top-level-tabs').last().click();
|
||||||
cy.get('@top-level-tabs')
|
cy.get('@top-level-tabs')
|
||||||
|
|
@ -76,7 +75,8 @@ describe('Dashboard tabs', () => {
|
||||||
.first()
|
.first()
|
||||||
.should('not.have.class', 'ant-tabs-tab-active');
|
.should('not.have.class', 'ant-tabs-tab-active');
|
||||||
waitForChartLoad(BOX_PLOT);
|
waitForChartLoad(BOX_PLOT);
|
||||||
cy.getBySel('grid-container').find('.box_plot').should('be.visible');
|
|
||||||
|
cy.get('[data-test-chart-name="Box plot"]').should('exist');
|
||||||
|
|
||||||
resetTabs();
|
resetTabs();
|
||||||
|
|
||||||
|
|
@ -88,7 +88,7 @@ describe('Dashboard tabs', () => {
|
||||||
|
|
||||||
cy.get('@row-level-tabs').last().click();
|
cy.get('@row-level-tabs').last().click();
|
||||||
waitForChartLoad(LINE_CHART);
|
waitForChartLoad(LINE_CHART);
|
||||||
cy.getBySel('grid-container').find('.line').should('be.visible');
|
cy.get('[data-test-chart-name="Trends"]').should('exist');
|
||||||
cy.get('@row-level-tabs').first().click();
|
cy.get('@row-level-tabs').first().click();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,9 +24,9 @@ export const WORLD_HEALTH_CHARTS = [
|
||||||
{ name: '% Rural', viz: 'world_map' },
|
{ name: '% Rural', viz: 'world_map' },
|
||||||
{ name: 'Most Populated Countries', viz: 'table' },
|
{ name: 'Most Populated Countries', viz: 'table' },
|
||||||
{ name: "World's Population", viz: 'big_number' },
|
{ name: "World's Population", viz: 'big_number' },
|
||||||
{ name: 'Growth Rate', viz: 'line' },
|
{ name: 'Growth Rate', viz: 'echarts_timeseries_line' },
|
||||||
{ name: 'Rural Breakdown', viz: 'sunburst_v2' },
|
{ name: 'Rural Breakdown', viz: 'sunburst_v2' },
|
||||||
{ name: "World's Pop Growth", viz: 'area' },
|
{ name: "World's Pop Growth", viz: 'echarts_area' },
|
||||||
{ name: 'Life Expectancy VS Rural %', viz: 'bubble' },
|
{ name: 'Life Expectancy VS Rural %', viz: 'bubble' },
|
||||||
{ name: 'Treemap', viz: 'treemap_v2' },
|
{ name: 'Treemap', viz: 'treemap_v2' },
|
||||||
{ name: 'Box plot', viz: 'box_plot' },
|
{ name: 'Box plot', viz: 'box_plot' },
|
||||||
|
|
@ -41,7 +41,7 @@ export const SUPPORTED_TIER1_CHARTS = [
|
||||||
{ name: 'Line Chart', viz: 'echarts_timeseries_line' },
|
{ name: 'Line Chart', viz: 'echarts_timeseries_line' },
|
||||||
{ name: 'Area Chart', viz: 'echarts_area' },
|
{ name: 'Area Chart', viz: 'echarts_area' },
|
||||||
{ name: 'Scatter Chart', viz: 'echarts_timeseries_scatter' },
|
{ name: 'Scatter Chart', viz: 'echarts_timeseries_scatter' },
|
||||||
{ name: 'Bar Chart V2', viz: 'echarts_timeseries_bar' },
|
{ name: 'Bar Chart', viz: 'echarts_timeseries_bar' },
|
||||||
] as ChartSpec[];
|
] as ChartSpec[];
|
||||||
|
|
||||||
export const SUPPORTED_TIER2_CHARTS = [
|
export const SUPPORTED_TIER2_CHARTS = [
|
||||||
|
|
|
||||||
|
|
@ -16,12 +16,13 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
import { interceptChart } from 'cypress/utils';
|
||||||
|
|
||||||
describe('AdhocMetrics', () => {
|
describe('AdhocMetrics', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.intercept('POST', '/superset/explore_json/**').as('postJson');
|
interceptChart({ legacy: false }).as('chartData');
|
||||||
cy.intercept('GET', '/superset/explore_json/**').as('getJson');
|
|
||||||
cy.visitChartByName('Num Births Trend');
|
cy.visitChartByName('Num Births Trend');
|
||||||
cy.verifySliceSuccess({ waitAlias: '@postJson' });
|
cy.verifySliceSuccess({ waitAlias: '@chartData' });
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Clear metric and set simple adhoc metric', () => {
|
it('Clear metric and set simple adhoc metric', () => {
|
||||||
|
|
@ -52,9 +53,8 @@ describe('AdhocMetrics', () => {
|
||||||
|
|
||||||
cy.get('button[data-test="run-query-button"]').click();
|
cy.get('button[data-test="run-query-button"]').click();
|
||||||
cy.verifySliceSuccess({
|
cy.verifySliceSuccess({
|
||||||
waitAlias: '@postJson',
|
waitAlias: '@chartData',
|
||||||
querySubstring: `${metric} AS "${metricName}"`, // SQL statement
|
querySubstring: `${metric} AS "${metricName}"`, // SQL statement
|
||||||
chartSelector: 'svg',
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -88,9 +88,8 @@ describe('AdhocMetrics', () => {
|
||||||
|
|
||||||
const metric = 'SUM(num)/COUNT(DISTINCT name)';
|
const metric = 'SUM(num)/COUNT(DISTINCT name)';
|
||||||
cy.verifySliceSuccess({
|
cy.verifySliceSuccess({
|
||||||
waitAlias: '@postJson',
|
waitAlias: '@chartData',
|
||||||
querySubstring: `${metric} AS "${metric}"`,
|
querySubstring: `${metric} AS "${metric}"`,
|
||||||
chartSelector: 'svg',
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -117,9 +116,8 @@ describe('AdhocMetrics', () => {
|
||||||
|
|
||||||
const metric = 'SUM(num)';
|
const metric = 'SUM(num)';
|
||||||
cy.verifySliceSuccess({
|
cy.verifySliceSuccess({
|
||||||
waitAlias: '@postJson',
|
waitAlias: '@chartData',
|
||||||
querySubstring: `${metric} AS "${metric}"`,
|
querySubstring: `${metric} AS "${metric}"`,
|
||||||
chartSelector: 'svg',
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -16,20 +16,21 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
import { interceptV1ChartData } from './utils';
|
||||||
|
|
||||||
describe('Advanced analytics', () => {
|
describe('Advanced analytics', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.intercept('POST', '/superset/explore_json/**').as('postJson');
|
interceptV1ChartData();
|
||||||
cy.intercept('GET', '/superset/explore_json/**').as('getJson');
|
|
||||||
cy.intercept('PUT', '/api/v1/explore/**').as('putExplore');
|
cy.intercept('PUT', '/api/v1/explore/**').as('putExplore');
|
||||||
cy.intercept('GET', '/explore/**').as('getExplore');
|
cy.intercept('GET', '/explore/**').as('getExplore');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Create custom time compare', () => {
|
it('Create custom time compare', () => {
|
||||||
cy.visitChartByName('Num Births Trend');
|
cy.visitChartByName('Num Births Trend');
|
||||||
cy.verifySliceSuccess({ waitAlias: '@postJson' });
|
cy.verifySliceSuccess({ waitAlias: '@v1Data' });
|
||||||
|
|
||||||
cy.get('.ant-collapse-header')
|
cy.get('.ant-collapse-header')
|
||||||
.contains('Advanced Analytics')
|
.contains('Advanced analytics')
|
||||||
.click({ force: true });
|
.click({ force: true });
|
||||||
|
|
||||||
cy.get('[data-test=time_compare]').find('.ant-select').click();
|
cy.get('[data-test=time_compare]').find('.ant-select').click();
|
||||||
|
|
@ -43,17 +44,16 @@ describe('Advanced analytics', () => {
|
||||||
.type('1 year{enter}');
|
.type('1 year{enter}');
|
||||||
|
|
||||||
cy.get('button[data-test="run-query-button"]').click();
|
cy.get('button[data-test="run-query-button"]').click();
|
||||||
cy.wait('@postJson');
|
cy.wait('@v1Data');
|
||||||
cy.wait('@putExplore');
|
cy.wait('@putExplore');
|
||||||
|
|
||||||
cy.reload();
|
cy.reload();
|
||||||
cy.verifySliceSuccess({
|
cy.verifySliceSuccess({
|
||||||
waitAlias: '@postJson',
|
waitAlias: '@v1Data',
|
||||||
chartSelector: 'svg',
|
|
||||||
});
|
});
|
||||||
cy.wait('@getExplore');
|
cy.wait('@getExplore');
|
||||||
cy.get('.ant-collapse-header')
|
cy.get('.ant-collapse-header')
|
||||||
.contains('Advanced Analytics')
|
.contains('Advanced analytics')
|
||||||
.click({ force: true });
|
.click({ force: true });
|
||||||
cy.get('[data-test=time_compare]')
|
cy.get('[data-test=time_compare]')
|
||||||
.find('.ant-select-selector')
|
.find('.ant-select-selector')
|
||||||
|
|
|
||||||
|
|
@ -16,18 +16,22 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
import { interceptChart } from 'cypress/utils';
|
||||||
|
|
||||||
describe('Annotations', () => {
|
describe('Annotations', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.intercept('POST', '/superset/explore_json/**').as('postJson');
|
interceptChart({ legacy: false }).as('chartData');
|
||||||
cy.intercept('GET', '/superset/explore_json/**').as('getJson');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Create formula annotation y-axis goal line', () => {
|
it('Create formula annotation y-axis goal line', () => {
|
||||||
cy.visitChartByName('Num Births Trend');
|
cy.visitChartByName('Num Births Trend');
|
||||||
cy.verifySliceSuccess({ waitAlias: '@postJson' });
|
cy.verifySliceSuccess({ waitAlias: '@chartData' });
|
||||||
|
|
||||||
const layerLabel = 'Goal line';
|
const layerLabel = 'Goal line';
|
||||||
|
|
||||||
|
// get by text Annotations and Layers
|
||||||
|
cy.get('span').contains('Annotations and Layers').click();
|
||||||
|
|
||||||
cy.get('[data-test=annotation_layers]').click();
|
cy.get('[data-test=annotation_layers]').click();
|
||||||
|
|
||||||
cy.get('[data-test="popover-content"]').within(() => {
|
cy.get('[data-test="popover-content"]').within(() => {
|
||||||
|
|
@ -39,10 +43,6 @@ describe('Annotations', () => {
|
||||||
cy.get('button[data-test="run-query-button"]').click();
|
cy.get('button[data-test="run-query-button"]').click();
|
||||||
cy.get('[data-test=annotation_layers]').contains(layerLabel);
|
cy.get('[data-test=annotation_layers]').contains(layerLabel);
|
||||||
|
|
||||||
cy.verifySliceSuccess({
|
cy.verifySliceSuccess({ waitAlias: '@chartData' });
|
||||||
waitAlias: '@postJson',
|
|
||||||
chartSelector: 'svg',
|
|
||||||
});
|
|
||||||
cy.get('.nv-legend-text').should('have.length', 2);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import { interceptGet as interceptDashboardGet } from 'cypress/e2e/dashboard/uti
|
||||||
import { FORM_DATA_DEFAULTS, NUM_METRIC } from './visualizations/shared.helper';
|
import { FORM_DATA_DEFAULTS, NUM_METRIC } from './visualizations/shared.helper';
|
||||||
import {
|
import {
|
||||||
interceptFiltering,
|
interceptFiltering,
|
||||||
|
interceptV1ChartData,
|
||||||
saveChartToDashboard,
|
saveChartToDashboard,
|
||||||
visitSampleChartFromList,
|
visitSampleChartFromList,
|
||||||
} from './utils';
|
} from './utils';
|
||||||
|
|
@ -124,14 +125,14 @@ describe('Cross-referenced dashboards', () => {
|
||||||
|
|
||||||
describe('No Results', () => {
|
describe('No Results', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.intercept('POST', '/superset/explore_json/**').as('getJson');
|
interceptV1ChartData();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('No results message shows up', () => {
|
it('No results message shows up', () => {
|
||||||
const formData = {
|
const formData = {
|
||||||
...FORM_DATA_DEFAULTS,
|
...FORM_DATA_DEFAULTS,
|
||||||
metrics: [NUM_METRIC],
|
metrics: [NUM_METRIC],
|
||||||
viz_type: 'line',
|
viz_type: 'echarts_timeseries_line',
|
||||||
adhoc_filters: [
|
adhoc_filters: [
|
||||||
{
|
{
|
||||||
expressionType: 'SIMPLE',
|
expressionType: 'SIMPLE',
|
||||||
|
|
@ -145,7 +146,7 @@ describe('No Results', () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
cy.visitChartByParams(formData);
|
cy.visitChartByParams(formData);
|
||||||
cy.wait('@getJson').its('response.statusCode').should('eq', 200);
|
cy.wait('@v1Data').its('response.statusCode').should('eq', 200);
|
||||||
cy.get('div.chart-container').contains(
|
cy.get('div.chart-container').contains(
|
||||||
'No results were returned for this query',
|
'No results were returned for this query',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -20,13 +20,12 @@
|
||||||
// Tests for setting controls in the UI
|
// Tests for setting controls in the UI
|
||||||
// ***********************************************
|
// ***********************************************
|
||||||
import { interceptChart } from 'cypress/utils';
|
import { interceptChart } from 'cypress/utils';
|
||||||
import { FORM_DATA_DEFAULTS, NUM_METRIC } from './visualizations/shared.helper';
|
|
||||||
|
|
||||||
describe('Datasource control', () => {
|
describe('Datasource control', () => {
|
||||||
const newMetricName = `abc${Date.now()}`;
|
const newMetricName = `abc${Date.now()}`;
|
||||||
|
|
||||||
it('should allow edit dataset', () => {
|
it('should allow edit dataset', () => {
|
||||||
interceptChart({ legacy: true }).as('chartData');
|
interceptChart({ legacy: false }).as('chartData');
|
||||||
|
|
||||||
cy.visitChartByName('Num Births Trend');
|
cy.visitChartByName('Num Births Trend');
|
||||||
cy.verifySliceSuccess({ waitAlias: '@chartData' });
|
cy.verifySliceSuccess({ waitAlias: '@chartData' });
|
||||||
|
|
@ -85,7 +84,7 @@ describe('Datasource control', () => {
|
||||||
|
|
||||||
describe('Color scheme control', () => {
|
describe('Color scheme control', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
interceptChart({ legacy: true }).as('chartData');
|
interceptChart({ legacy: false }).as('chartData');
|
||||||
|
|
||||||
cy.visitChartByName('Num Births Trend');
|
cy.visitChartByName('Num Births Trend');
|
||||||
cy.verifySliceSuccess({ waitAlias: '@chartData' });
|
cy.verifySliceSuccess({ waitAlias: '@chartData' });
|
||||||
|
|
@ -137,7 +136,7 @@ describe('VizType control', () => {
|
||||||
describe('Test datatable', () => {
|
describe('Test datatable', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
interceptChart({ legacy: false }).as('tableChartData');
|
interceptChart({ legacy: false }).as('tableChartData');
|
||||||
interceptChart({ legacy: true }).as('lineChartData');
|
interceptChart({ legacy: false }).as('lineChartData');
|
||||||
cy.visitChartByName('Daily Totals');
|
cy.visitChartByName('Daily Totals');
|
||||||
});
|
});
|
||||||
it('Data Pane opens and loads results', () => {
|
it('Data Pane opens and loads results', () => {
|
||||||
|
|
@ -157,107 +156,9 @@ describe('Test datatable', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Time range filter', () => {
|
|
||||||
beforeEach(() => {
|
|
||||||
interceptChart({ legacy: true }).as('chartData');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Advanced time_range params', () => {
|
|
||||||
const formData = {
|
|
||||||
...FORM_DATA_DEFAULTS,
|
|
||||||
viz_type: 'line',
|
|
||||||
time_range: '100 years ago : now',
|
|
||||||
metrics: [NUM_METRIC],
|
|
||||||
};
|
|
||||||
|
|
||||||
cy.visitChartByParams(formData);
|
|
||||||
cy.verifySliceSuccess({ waitAlias: '@chartData' });
|
|
||||||
|
|
||||||
cy.get('[data-test=time-range-trigger]').click();
|
|
||||||
cy.get('.footer').find('button').its('length').should('eq', 2);
|
|
||||||
cy.get('.ant-popover-content').within(() => {
|
|
||||||
cy.get('input[value="100 years ago"]');
|
|
||||||
cy.get('input[value="now"]');
|
|
||||||
});
|
|
||||||
cy.get('[data-test=cancel-button]').click();
|
|
||||||
cy.wait(500);
|
|
||||||
cy.get('.ant-popover').should('not.exist');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Common time_range params', () => {
|
|
||||||
const formData = {
|
|
||||||
...FORM_DATA_DEFAULTS,
|
|
||||||
viz_type: 'line',
|
|
||||||
metrics: [NUM_METRIC],
|
|
||||||
time_range: 'Last year',
|
|
||||||
};
|
|
||||||
|
|
||||||
cy.visitChartByParams(formData);
|
|
||||||
cy.verifySliceSuccess({ waitAlias: '@chartData' });
|
|
||||||
|
|
||||||
cy.get('[data-test=time-range-trigger]').click();
|
|
||||||
cy.get('.ant-radio-group').children().its('length').should('eq', 5);
|
|
||||||
cy.get('.ant-radio-checked + span').contains('Last year');
|
|
||||||
cy.get('[data-test=cancel-button]').click();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Previous time_range params', () => {
|
|
||||||
const formData = {
|
|
||||||
...FORM_DATA_DEFAULTS,
|
|
||||||
viz_type: 'line',
|
|
||||||
metrics: [NUM_METRIC],
|
|
||||||
time_range: 'previous calendar month',
|
|
||||||
};
|
|
||||||
|
|
||||||
cy.visitChartByParams(formData);
|
|
||||||
cy.verifySliceSuccess({ waitAlias: '@chartData' });
|
|
||||||
|
|
||||||
cy.get('[data-test=time-range-trigger]').click();
|
|
||||||
cy.get('.ant-radio-group').children().its('length').should('eq', 3);
|
|
||||||
cy.get('.ant-radio-checked + span').contains('previous calendar month');
|
|
||||||
cy.get('[data-test=cancel-button]').click();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Custom time_range params', () => {
|
|
||||||
const formData = {
|
|
||||||
...FORM_DATA_DEFAULTS,
|
|
||||||
viz_type: 'line',
|
|
||||||
metrics: [NUM_METRIC],
|
|
||||||
time_range: 'DATEADD(DATETIME("today"), -7, day) : today',
|
|
||||||
};
|
|
||||||
|
|
||||||
cy.visitChartByParams(formData);
|
|
||||||
cy.verifySliceSuccess({ waitAlias: '@chartData' });
|
|
||||||
|
|
||||||
cy.get('[data-test=time-range-trigger]').click();
|
|
||||||
cy.get('[data-test=custom-frame]').then(() => {
|
|
||||||
cy.get('.antd5-input-number-input-wrap > input')
|
|
||||||
.invoke('attr', 'value')
|
|
||||||
.should('eq', '7');
|
|
||||||
});
|
|
||||||
cy.get('[data-test=cancel-button]').click();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('No filter time_range params', () => {
|
|
||||||
const formData = {
|
|
||||||
...FORM_DATA_DEFAULTS,
|
|
||||||
viz_type: 'line',
|
|
||||||
metrics: [NUM_METRIC],
|
|
||||||
time_range: 'No filter',
|
|
||||||
};
|
|
||||||
|
|
||||||
cy.visitChartByParams(formData);
|
|
||||||
cy.verifySliceSuccess({ waitAlias: '@chartData' });
|
|
||||||
|
|
||||||
cy.get('[data-test=time-range-trigger]').click();
|
|
||||||
cy.get('[data-test=no-filter]').should('exist');
|
|
||||||
cy.get('[data-test=cancel-button]').click();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('Groupby control', () => {
|
describe('Groupby control', () => {
|
||||||
it('Set groupby', () => {
|
it('Set groupby', () => {
|
||||||
interceptChart({ legacy: true }).as('chartData');
|
interceptChart({ legacy: false }).as('chartData');
|
||||||
|
|
||||||
cy.visitChartByName('Num Births Trend');
|
cy.visitChartByName('Num Births Trend');
|
||||||
cy.verifySliceSuccess({ waitAlias: '@chartData' });
|
cy.verifySliceSuccess({ waitAlias: '@chartData' });
|
||||||
|
|
@ -271,6 +172,6 @@ describe('Groupby control', () => {
|
||||||
cy.get('[data-test="ColumnEdit#save"]').contains('Save').click();
|
cy.get('[data-test="ColumnEdit#save"]').contains('Save').click();
|
||||||
|
|
||||||
cy.get('button[data-test="run-query-button"]').click();
|
cy.get('button[data-test="run-query-button"]').click();
|
||||||
cy.verifySliceSuccess({ waitAlias: '@chartData', chartSelector: 'svg' });
|
cy.verifySliceSuccess({ waitAlias: '@chartData' });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ const apiURL = (endpoint: string, queryObject: Record<string, unknown>) =>
|
||||||
|
|
||||||
describe('Test explore links', () => {
|
describe('Test explore links', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
interceptChart({ legacy: true }).as('chartData');
|
interceptChart({ legacy: false }).as('chartData');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Open and close view query modal', () => {
|
it('Open and close view query modal', () => {
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ export function saveChartToDashboard(dashboardName: string) {
|
||||||
.click();
|
.click();
|
||||||
cy.get(
|
cy.get(
|
||||||
'.ant-select-selection-search-input[aria-label="Select a dashboard"]',
|
'.ant-select-selection-search-input[aria-label="Select a dashboard"]',
|
||||||
).type(dashboardName.slice(0, 3), { force: true });
|
).type(dashboardName, { force: true });
|
||||||
cy.get(`.ant-select-item-option[title="${dashboardName}"]`).click();
|
cy.get(`.ant-select-item-option[title="${dashboardName}"]`).click();
|
||||||
cy.getBySel('btn-modal-save').click();
|
cy.getBySel('btn-modal-save').click();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,120 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
describe('Visualization > Area', () => {
|
|
||||||
beforeEach(() => {
|
|
||||||
cy.intercept('POST', '/superset/explore_json/**').as('getJson');
|
|
||||||
});
|
|
||||||
|
|
||||||
const AREA_FORM_DATA = {
|
|
||||||
datasource: '2__table',
|
|
||||||
viz_type: 'area',
|
|
||||||
slice_id: 48,
|
|
||||||
granularity_sqla: 'year',
|
|
||||||
time_grain_sqla: 'P1D',
|
|
||||||
time_range: '1960-01-01 : now',
|
|
||||||
metrics: ['sum__SP_POP_TOTL'],
|
|
||||||
adhoc_filters: [],
|
|
||||||
groupby: [],
|
|
||||||
limit: '25',
|
|
||||||
order_desc: true,
|
|
||||||
contribution: false,
|
|
||||||
row_limit: 50000,
|
|
||||||
show_brush: 'auto',
|
|
||||||
show_legend: true,
|
|
||||||
line_interpolation: 'linear',
|
|
||||||
stacked_style: 'stack',
|
|
||||||
color_scheme: 'bnbColors',
|
|
||||||
rich_tooltip: true,
|
|
||||||
show_controls: false,
|
|
||||||
x_axis_label: '',
|
|
||||||
bottom_margin: 'auto',
|
|
||||||
x_ticks_layout: 'auto',
|
|
||||||
x_axis_format: 'smart_date',
|
|
||||||
x_axis_showminmax: false,
|
|
||||||
y_axis_format: '.3s',
|
|
||||||
y_log_scale: false,
|
|
||||||
rolling_type: 'None',
|
|
||||||
comparison_type: 'values',
|
|
||||||
annotation_layers: [],
|
|
||||||
};
|
|
||||||
|
|
||||||
function verify(formData) {
|
|
||||||
cy.visitChartByParams(formData);
|
|
||||||
cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' });
|
|
||||||
}
|
|
||||||
|
|
||||||
it('should work without groupby', () => {
|
|
||||||
verify(AREA_FORM_DATA);
|
|
||||||
cy.get('.nv-area').should('have.length', 1);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should work with group by', () => {
|
|
||||||
verify({
|
|
||||||
...AREA_FORM_DATA,
|
|
||||||
groupby: ['region'],
|
|
||||||
});
|
|
||||||
|
|
||||||
cy.get('.nv-area').should('have.length', 7);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should work with groupby and filter', () => {
|
|
||||||
cy.visitChartByParams({
|
|
||||||
...AREA_FORM_DATA,
|
|
||||||
groupby: ['region'],
|
|
||||||
adhoc_filters: [
|
|
||||||
{
|
|
||||||
expressionType: 'SIMPLE',
|
|
||||||
subject: 'region',
|
|
||||||
operator: 'IN',
|
|
||||||
comparator: ['South Asia', 'North America'],
|
|
||||||
clause: 'WHERE',
|
|
||||||
sqlExpression: null,
|
|
||||||
filterOptionName: 'filter_txje2ikiv6_wxmn0qwd1xo',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
|
|
||||||
cy.wait('@getJson').then(async ({ response }) => {
|
|
||||||
const responseBody = response?.body;
|
|
||||||
// Make sure data is sorted correctly
|
|
||||||
const firstRow = responseBody.data[0].values;
|
|
||||||
const secondRow = responseBody.data[1].values;
|
|
||||||
expect(firstRow[firstRow.length - 1].y).to.be.greaterThan(
|
|
||||||
secondRow[secondRow.length - 1].y,
|
|
||||||
);
|
|
||||||
cy.verifySliceContainer('svg');
|
|
||||||
});
|
|
||||||
cy.get('.nv-area').should('have.length', 2);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should allow type to search color schemes and apply the scheme', () => {
|
|
||||||
verify(AREA_FORM_DATA);
|
|
||||||
|
|
||||||
cy.get('#controlSections-tab-display').click();
|
|
||||||
cy.get('.Control[data-test="color_scheme"]').scrollIntoView();
|
|
||||||
cy.get('.Control[data-test="color_scheme"] input[type="search"]').focus();
|
|
||||||
cy.focused().type('supersetColors{enter}');
|
|
||||||
cy.get(
|
|
||||||
'.Control[data-test="color_scheme"] .ant-select-selection-item [data-test="supersetColors"]',
|
|
||||||
).should('exist');
|
|
||||||
cy.get('.area .nv-legend .nv-legend-symbol')
|
|
||||||
.first()
|
|
||||||
.should('have.css', 'fill', 'rgb(31, 168, 201)');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
@ -1,90 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
import { FORM_DATA_DEFAULTS, NUM_METRIC } from './shared.helper';
|
|
||||||
|
|
||||||
describe('Visualization > Distribution bar chart', () => {
|
|
||||||
beforeEach(() => {
|
|
||||||
cy.intercept('POST', '/superset/explore_json/**').as('getJson');
|
|
||||||
});
|
|
||||||
|
|
||||||
const VIZ_DEFAULTS = { ...FORM_DATA_DEFAULTS, viz_type: 'dist_bar' };
|
|
||||||
const DISTBAR_FORM_DATA = {
|
|
||||||
...VIZ_DEFAULTS,
|
|
||||||
metrics: NUM_METRIC,
|
|
||||||
groupby: ['state'],
|
|
||||||
};
|
|
||||||
|
|
||||||
it('should work with adhoc metric', () => {
|
|
||||||
cy.visitChartByParams(DISTBAR_FORM_DATA);
|
|
||||||
cy.verifySliceSuccess({
|
|
||||||
waitAlias: '@getJson',
|
|
||||||
querySubstring: NUM_METRIC.label,
|
|
||||||
chartSelector: 'svg',
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should work with series', () => {
|
|
||||||
const formData = {
|
|
||||||
...VIZ_DEFAULTS,
|
|
||||||
metrics: NUM_METRIC,
|
|
||||||
groupby: ['state'],
|
|
||||||
columns: ['gender'],
|
|
||||||
};
|
|
||||||
|
|
||||||
cy.visitChartByParams(formData);
|
|
||||||
cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should work with row limit', () => {
|
|
||||||
const formData = {
|
|
||||||
...VIZ_DEFAULTS,
|
|
||||||
metrics: NUM_METRIC,
|
|
||||||
groupby: ['state'],
|
|
||||||
row_limit: 10,
|
|
||||||
};
|
|
||||||
|
|
||||||
cy.visitChartByParams(formData);
|
|
||||||
cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should work with contribution', () => {
|
|
||||||
const formData = {
|
|
||||||
...VIZ_DEFAULTS,
|
|
||||||
metrics: NUM_METRIC,
|
|
||||||
groupby: ['state'],
|
|
||||||
columns: ['gender'],
|
|
||||||
contribution: true,
|
|
||||||
};
|
|
||||||
|
|
||||||
cy.visitChartByParams(formData);
|
|
||||||
cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should allow type to search color schemes and apply the scheme', () => {
|
|
||||||
cy.visitChartByParams(DISTBAR_FORM_DATA);
|
|
||||||
|
|
||||||
cy.get('#controlSections-tab-display').click();
|
|
||||||
cy.get('.Control[data-test="color_scheme"]').scrollIntoView();
|
|
||||||
cy.get('.Control[data-test="color_scheme"] input[type="search"]').focus();
|
|
||||||
cy.focused().type('bnbColors{enter}');
|
|
||||||
cy.get(
|
|
||||||
'.Control[data-test="color_scheme"] .ant-select-selection-item [data-test="bnbColors"]',
|
|
||||||
).should('exist');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
@ -18,8 +18,11 @@
|
||||||
*/
|
*/
|
||||||
import { FORM_DATA_DEFAULTS, NUM_METRIC } from './shared.helper';
|
import { FORM_DATA_DEFAULTS, NUM_METRIC } from './shared.helper';
|
||||||
|
|
||||||
describe('Download Chart > Distribution bar chart', () => {
|
describe('Download Chart > Bar chart', () => {
|
||||||
const VIZ_DEFAULTS = { ...FORM_DATA_DEFAULTS, viz_type: 'dist_bar' };
|
const VIZ_DEFAULTS = {
|
||||||
|
...FORM_DATA_DEFAULTS,
|
||||||
|
viz_type: 'echarts_timeseries_bar',
|
||||||
|
};
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.intercept('POST', '/superset/explore_json/**').as('getJson');
|
cy.intercept('POST', '/superset/explore_json/**').as('getJson');
|
||||||
|
|
|
||||||
|
|
@ -1,102 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
import { QueryFormData } from '@superset-ui/core';
|
|
||||||
|
|
||||||
describe('Visualization > Histogram', () => {
|
|
||||||
beforeEach(() => {
|
|
||||||
cy.intercept('POST', '/superset/explore_json/**').as('getJson');
|
|
||||||
});
|
|
||||||
|
|
||||||
const HISTOGRAM_FORM_DATA: QueryFormData = {
|
|
||||||
datasource: '3__table',
|
|
||||||
viz_type: 'histogram',
|
|
||||||
slice_id: 60,
|
|
||||||
granularity_sqla: 'ds',
|
|
||||||
time_grain_sqla: 'P1D',
|
|
||||||
time_range: '100 years ago : now',
|
|
||||||
all_columns_x: ['num'],
|
|
||||||
adhoc_filters: [],
|
|
||||||
row_limit: 50000,
|
|
||||||
groupby: [],
|
|
||||||
color_scheme: 'bnbColors',
|
|
||||||
link_length: 5, // number of bins
|
|
||||||
x_axis_label: 'Frequency',
|
|
||||||
y_axis_label: 'Num',
|
|
||||||
global_opacity: 1,
|
|
||||||
normalized: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
function verify(formData: QueryFormData) {
|
|
||||||
cy.visitChartByParams(formData);
|
|
||||||
cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' });
|
|
||||||
}
|
|
||||||
|
|
||||||
it('should work without groupby', () => {
|
|
||||||
verify(HISTOGRAM_FORM_DATA);
|
|
||||||
cy.get('.chart-container svg .vx-bar').should(
|
|
||||||
'have.length',
|
|
||||||
HISTOGRAM_FORM_DATA.link_length,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should work with group by', () => {
|
|
||||||
verify({
|
|
||||||
...HISTOGRAM_FORM_DATA,
|
|
||||||
groupby: ['gender'],
|
|
||||||
});
|
|
||||||
cy.get('.chart-container svg .vx-bar').should(
|
|
||||||
'have.length',
|
|
||||||
HISTOGRAM_FORM_DATA.link_length * 2,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should work with filter and update num bins', () => {
|
|
||||||
const numBins = 2;
|
|
||||||
verify({
|
|
||||||
...HISTOGRAM_FORM_DATA,
|
|
||||||
link_length: numBins,
|
|
||||||
adhoc_filters: [
|
|
||||||
{
|
|
||||||
expressionType: 'SIMPLE',
|
|
||||||
clause: 'WHERE',
|
|
||||||
subject: 'state',
|
|
||||||
operator: '==',
|
|
||||||
comparator: 'CA',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
cy.get('.chart-container svg .vx-bar').should('have.length', numBins);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should allow type to search color schemes and apply the scheme', () => {
|
|
||||||
verify(HISTOGRAM_FORM_DATA);
|
|
||||||
|
|
||||||
cy.get('#controlSections-tab-display').click();
|
|
||||||
cy.get('.Control[data-test="color_scheme"]').scrollIntoView();
|
|
||||||
cy.get('.Control[data-test="color_scheme"] input[type="search"]').focus();
|
|
||||||
cy.focused().type('supersetColors{enter}');
|
|
||||||
cy.get(
|
|
||||||
'.Control[data-test="color_scheme"] .ant-select-selection-item [data-test="supersetColors"]',
|
|
||||||
).should('exist');
|
|
||||||
cy.get('.histogram .vx-legend .vx-legend-shape div')
|
|
||||||
.first()
|
|
||||||
.should('have.css', 'background')
|
|
||||||
.and('contains', 'rgb(31, 168, 201)');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
@ -1,302 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
import { FORM_DATA_DEFAULTS, NUM_METRIC, SIMPLE_FILTER } from './shared.helper';
|
|
||||||
|
|
||||||
describe('Visualization > Line', () => {
|
|
||||||
beforeEach(() => {
|
|
||||||
cy.intercept('POST', '/superset/explore_json/**').as('getJson');
|
|
||||||
});
|
|
||||||
|
|
||||||
const LINE_CHART_DEFAULTS = { ...FORM_DATA_DEFAULTS, viz_type: 'line' };
|
|
||||||
|
|
||||||
it('should show validator error when no metric', () => {
|
|
||||||
const formData = { ...LINE_CHART_DEFAULTS, metrics: [] };
|
|
||||||
cy.visitChartByParams(formData);
|
|
||||||
cy.get('.panel-body').contains(
|
|
||||||
`Add required control values to preview chart`,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should not show validator error when metric added', () => {
|
|
||||||
const formData = { ...LINE_CHART_DEFAULTS, metrics: [] };
|
|
||||||
cy.visitChartByParams(formData);
|
|
||||||
cy.get('.panel-body').contains(
|
|
||||||
`Add required control values to preview chart`,
|
|
||||||
);
|
|
||||||
cy.get('[data-test="metrics-header"]').contains('Metrics');
|
|
||||||
cy.get('[data-test="metrics-header"] [data-test="error-tooltip"]').should(
|
|
||||||
'exist',
|
|
||||||
);
|
|
||||||
|
|
||||||
cy.get('[data-test=metrics]')
|
|
||||||
.contains('Drop columns/metrics here or click')
|
|
||||||
.click();
|
|
||||||
|
|
||||||
// Title edit for saved metrics is disabled - switch to Simple
|
|
||||||
cy.get('[id="adhoc-metric-edit-tabs-tab-SIMPLE"]').click();
|
|
||||||
|
|
||||||
cy.get('input[aria-label="Select column"]').click();
|
|
||||||
cy.get('input[aria-label="Select column"]').type('num{enter}');
|
|
||||||
cy.get('input[aria-label="Select aggregate options"]').click();
|
|
||||||
cy.get('input[aria-label="Select aggregate options"]').type('sum{enter}');
|
|
||||||
cy.get('[data-test="AdhocMetricEdit#save"]').contains('Save').click();
|
|
||||||
|
|
||||||
cy.get('[data-test="metrics-header"]').contains('Metrics');
|
|
||||||
cy.get('[data-test="metrics-header"] [data-test="error-tooltip"]').should(
|
|
||||||
'not.exist',
|
|
||||||
);
|
|
||||||
|
|
||||||
cy.get('.antd5-alert-warning').should('not.exist');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should allow negative values in Y bounds', () => {
|
|
||||||
const formData = { ...LINE_CHART_DEFAULTS, metrics: [NUM_METRIC] };
|
|
||||||
cy.visitChartByParams(formData);
|
|
||||||
cy.get('#controlSections-tab-display').click();
|
|
||||||
cy.get('span').contains('Y Axis Bounds').scrollIntoView();
|
|
||||||
cy.get('input[placeholder="Min"]').type('-0.1', { delay: 100 });
|
|
||||||
cy.get('.antd5-alert-warning').should('not.exist');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should allow type to search color schemes and apply the scheme', () => {
|
|
||||||
cy.get('#controlSections-tab-display').click();
|
|
||||||
cy.get('.Control[data-test="color_scheme"]').scrollIntoView();
|
|
||||||
cy.get('.Control[data-test="color_scheme"] input[type="search"]').focus();
|
|
||||||
cy.focused().type('bnbColors{enter}');
|
|
||||||
cy.get(
|
|
||||||
'.Control[data-test="color_scheme"] .ant-select-selection-item [data-test="bnbColors"]',
|
|
||||||
).should('exist');
|
|
||||||
cy.get('.line .nv-legend .nv-legend-symbol')
|
|
||||||
.first()
|
|
||||||
.should('have.css', 'fill', 'rgb(41, 105, 107)');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should work with adhoc metric', () => {
|
|
||||||
const formData = { ...LINE_CHART_DEFAULTS, metrics: [NUM_METRIC] };
|
|
||||||
cy.visitChartByParams(formData);
|
|
||||||
cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should work with groupby', () => {
|
|
||||||
const metrics = ['count'];
|
|
||||||
const groupby = ['gender'];
|
|
||||||
const formData = { ...LINE_CHART_DEFAULTS, metrics, groupby };
|
|
||||||
cy.visitChartByParams(formData);
|
|
||||||
cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should work with simple filter', () => {
|
|
||||||
const metrics = ['count'];
|
|
||||||
const filters = [SIMPLE_FILTER];
|
|
||||||
const formData = {
|
|
||||||
...LINE_CHART_DEFAULTS,
|
|
||||||
metrics,
|
|
||||||
adhoc_filters: filters,
|
|
||||||
};
|
|
||||||
cy.visitChartByParams(formData);
|
|
||||||
cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should work with series limit sort asc', () => {
|
|
||||||
const formData = {
|
|
||||||
...LINE_CHART_DEFAULTS,
|
|
||||||
metrics: [NUM_METRIC],
|
|
||||||
limit: 10,
|
|
||||||
groupby: ['name'],
|
|
||||||
timeseries_limit_metric: NUM_METRIC,
|
|
||||||
};
|
|
||||||
cy.visitChartByParams(formData);
|
|
||||||
cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should work with series limit sort desc', () => {
|
|
||||||
const formData = {
|
|
||||||
...LINE_CHART_DEFAULTS,
|
|
||||||
metrics: [NUM_METRIC],
|
|
||||||
limit: 10,
|
|
||||||
groupby: ['name'],
|
|
||||||
timeseries_limit_metric: NUM_METRIC,
|
|
||||||
order_desc: true,
|
|
||||||
};
|
|
||||||
cy.visitChartByParams(formData);
|
|
||||||
cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should work with rolling avg', () => {
|
|
||||||
const metrics = [NUM_METRIC];
|
|
||||||
const formData = {
|
|
||||||
...LINE_CHART_DEFAULTS,
|
|
||||||
metrics,
|
|
||||||
rolling_type: 'mean',
|
|
||||||
rolling_periods: 10,
|
|
||||||
};
|
|
||||||
cy.visitChartByParams(formData);
|
|
||||||
cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should work with time shift 1 year', () => {
|
|
||||||
const metrics = [NUM_METRIC];
|
|
||||||
const formData = {
|
|
||||||
...LINE_CHART_DEFAULTS,
|
|
||||||
metrics,
|
|
||||||
time_compare: ['1 year'],
|
|
||||||
comparison_type: 'values',
|
|
||||||
groupby: ['gender'],
|
|
||||||
};
|
|
||||||
|
|
||||||
cy.visitChartByParams(formData);
|
|
||||||
cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' });
|
|
||||||
|
|
||||||
// Offset color should match original line color
|
|
||||||
cy.get('.nv-legend-text')
|
|
||||||
.contains('boy')
|
|
||||||
.siblings()
|
|
||||||
.first()
|
|
||||||
.should('have.attr', 'style')
|
|
||||||
.then(style => {
|
|
||||||
cy.get('.nv-legend-text')
|
|
||||||
.contains('boy, 1 year offset')
|
|
||||||
.siblings()
|
|
||||||
.first()
|
|
||||||
.should('have.attr', 'style')
|
|
||||||
.and('eq', style);
|
|
||||||
});
|
|
||||||
|
|
||||||
cy.get('.nv-legend-text')
|
|
||||||
.contains('girl')
|
|
||||||
.siblings()
|
|
||||||
.first()
|
|
||||||
.should('have.attr', 'style')
|
|
||||||
.then(style => {
|
|
||||||
cy.get('.nv-legend-text')
|
|
||||||
.contains('girl, 1 year offset')
|
|
||||||
.siblings()
|
|
||||||
.first()
|
|
||||||
.should('have.attr', 'style')
|
|
||||||
.and('eq', style);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should work with time shift yoy', () => {
|
|
||||||
const metrics = [NUM_METRIC];
|
|
||||||
const formData = {
|
|
||||||
...LINE_CHART_DEFAULTS,
|
|
||||||
metrics,
|
|
||||||
time_compare: ['1 year'],
|
|
||||||
comparison_type: 'ratio',
|
|
||||||
};
|
|
||||||
cy.visitChartByParams(formData);
|
|
||||||
cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should work with time shift percentage change', () => {
|
|
||||||
const metrics = [NUM_METRIC];
|
|
||||||
const formData = {
|
|
||||||
...LINE_CHART_DEFAULTS,
|
|
||||||
metrics,
|
|
||||||
time_compare: ['1 year'],
|
|
||||||
comparison_type: 'percentage',
|
|
||||||
};
|
|
||||||
cy.visitChartByParams(formData);
|
|
||||||
cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Test verbose name shows up in legend', () => {
|
|
||||||
const formData = {
|
|
||||||
...LINE_CHART_DEFAULTS,
|
|
||||||
metrics: ['count'],
|
|
||||||
};
|
|
||||||
cy.visitChartByParams(formData);
|
|
||||||
cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' });
|
|
||||||
cy.get('text.nv-legend-text').contains('COUNT(*)');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Test hidden annotation', () => {
|
|
||||||
const formData = {
|
|
||||||
...LINE_CHART_DEFAULTS,
|
|
||||||
metrics: ['count'],
|
|
||||||
annotation_layers: [
|
|
||||||
{
|
|
||||||
name: 'Goal line',
|
|
||||||
annotationType: 'FORMULA',
|
|
||||||
sourceType: '',
|
|
||||||
value: 'y=140000',
|
|
||||||
overrides: { time_range: null },
|
|
||||||
show: false,
|
|
||||||
showLabel: false,
|
|
||||||
titleColumn: '',
|
|
||||||
descriptionColumns: [],
|
|
||||||
timeColumn: '',
|
|
||||||
intervalEndColumn: '',
|
|
||||||
color: null,
|
|
||||||
opacity: '',
|
|
||||||
style: 'solid',
|
|
||||||
width: 1,
|
|
||||||
showMarkers: false,
|
|
||||||
hideLine: false,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
cy.visitChartByParams(formData);
|
|
||||||
cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' });
|
|
||||||
cy.get('.slice_container').within(() => {
|
|
||||||
// Goal line annotation doesn't show up in legend
|
|
||||||
cy.get('.nv-legend-text').should('have.length', 1);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Test event annotation time override', () => {
|
|
||||||
cy.request('/chart/api/read?_flt_3_slice_name=Daily+Totals').then(
|
|
||||||
response => {
|
|
||||||
const value = response.body.pks[0];
|
|
||||||
const formData = {
|
|
||||||
...LINE_CHART_DEFAULTS,
|
|
||||||
metrics: ['count'],
|
|
||||||
annotation_layers: [
|
|
||||||
{
|
|
||||||
name: 'Yearly date',
|
|
||||||
annotationType: 'EVENT',
|
|
||||||
sourceType: 'table',
|
|
||||||
value,
|
|
||||||
overrides: { time_range: null },
|
|
||||||
show: true,
|
|
||||||
showLabel: false,
|
|
||||||
titleColumn: 'ds',
|
|
||||||
descriptionColumns: ['ds'],
|
|
||||||
timeColumn: 'ds',
|
|
||||||
color: null,
|
|
||||||
opacity: '',
|
|
||||||
style: 'solid',
|
|
||||||
width: 1,
|
|
||||||
showMarkers: false,
|
|
||||||
hideLine: false,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
cy.visitChartByParams(formData);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' });
|
|
||||||
cy.get('.slice_container').within(() => {
|
|
||||||
cy.get('.nv-event-annotation-layer-0')
|
|
||||||
.children()
|
|
||||||
.should('have.length', 44);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
@ -1,87 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
describe('Visualization > Sankey', () => {
|
|
||||||
beforeEach(() => {
|
|
||||||
cy.intercept('POST', '/superset/explore_json/**').as('getJson');
|
|
||||||
});
|
|
||||||
|
|
||||||
const SANKEY_FORM_DATA = {
|
|
||||||
datasource: '1__table',
|
|
||||||
viz_type: 'sankey',
|
|
||||||
slice_id: 1,
|
|
||||||
url_params: {},
|
|
||||||
granularity_sqla: null,
|
|
||||||
time_grain_sqla: 'P1D',
|
|
||||||
time_range: 'Last week',
|
|
||||||
groupby: ['source', 'target'],
|
|
||||||
metric: 'sum__value',
|
|
||||||
adhoc_filters: [],
|
|
||||||
row_limit: '5000',
|
|
||||||
color_scheme: 'bnbColors',
|
|
||||||
};
|
|
||||||
|
|
||||||
function verify(formData) {
|
|
||||||
cy.visitChartByParams(formData);
|
|
||||||
cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' });
|
|
||||||
}
|
|
||||||
|
|
||||||
it('should work', () => {
|
|
||||||
verify(SANKEY_FORM_DATA);
|
|
||||||
cy.get('.chart-container svg g.node rect').should('have.length', 41);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should work with filter', () => {
|
|
||||||
verify({
|
|
||||||
...SANKEY_FORM_DATA,
|
|
||||||
adhoc_filters: [
|
|
||||||
{
|
|
||||||
expressionType: 'SQL',
|
|
||||||
sqlExpression: 'SUM(value) > 0',
|
|
||||||
clause: 'HAVING',
|
|
||||||
subject: null,
|
|
||||||
operator: null,
|
|
||||||
comparator: null,
|
|
||||||
filterOptionName: 'filter_jbdwe0hayaj_h9jfer8fy58',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
expressionType: 'SIMPLE',
|
|
||||||
subject: 'source',
|
|
||||||
operator: '==',
|
|
||||||
comparator: 'Energy',
|
|
||||||
clause: 'WHERE',
|
|
||||||
sqlExpression: null,
|
|
||||||
filterOptionName: 'filter_8e0otka9uif_vmqri4gmbqc',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
cy.get('.chart-container svg g.node rect').should('have.length', 6);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should allow type to search color schemes', () => {
|
|
||||||
verify(SANKEY_FORM_DATA);
|
|
||||||
|
|
||||||
cy.get('#controlSections-tab-display').click();
|
|
||||||
cy.get('.Control[data-test="color_scheme"]').scrollIntoView();
|
|
||||||
cy.get('.Control[data-test="color_scheme"] input[type="search"]').focus();
|
|
||||||
cy.focused().type('bnbColors{enter}');
|
|
||||||
cy.get(
|
|
||||||
'.Control[data-test="color_scheme"] .ant-select-selection-item [data-test="bnbColors"]',
|
|
||||||
).should('exist');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
@ -22,15 +22,22 @@
|
||||||
|
|
||||||
export const FORM_DATA_DEFAULTS = {
|
export const FORM_DATA_DEFAULTS = {
|
||||||
datasource: '3__table',
|
datasource: '3__table',
|
||||||
granularity_sqla: 'ds',
|
|
||||||
time_grain_sqla: null,
|
time_grain_sqla: null,
|
||||||
time_range: '100 years ago : now',
|
x_axis: 'ds',
|
||||||
adhoc_filters: [],
|
adhoc_filters: [
|
||||||
|
{
|
||||||
|
clause: 'WHERE',
|
||||||
|
subject: 'ds',
|
||||||
|
operator: 'TEMPORAL_RANGE',
|
||||||
|
comparator: '100 years ago : now',
|
||||||
|
expressionType: 'SIMPLE',
|
||||||
|
},
|
||||||
|
],
|
||||||
groupby: [],
|
groupby: [],
|
||||||
limit: null,
|
limit: null,
|
||||||
timeseries_limit_metric: null,
|
timeseries_limit_metric: null,
|
||||||
order_desc: false,
|
order_desc: false,
|
||||||
contribution: false,
|
contributionMode: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const HEALTH_POP_FORM_DATA_DEFAULTS = {
|
export const HEALTH_POP_FORM_DATA_DEFAULTS = {
|
||||||
|
|
|
||||||
|
|
@ -3,40 +3,40 @@
|
||||||
"slice_name": "1 - Sample chart",
|
"slice_name": "1 - Sample chart",
|
||||||
"description": "chart description",
|
"description": "chart description",
|
||||||
"owners": [1],
|
"owners": [1],
|
||||||
"viz_type": "line",
|
"viz_type": "echarts_timeseries_line",
|
||||||
"cache_timeout": 1000,
|
"cache_timeout": 1000,
|
||||||
"datasource_id": 2,
|
"datasource_id": 2,
|
||||||
"datasource_type": "table",
|
"datasource_type": "table",
|
||||||
"params": "{\"viz_type\":\"line\",\"metrics\":[\"count\"]}"
|
"params": "{\"viz_type\":\"echarts_timeseries_line\",\"x_axis\":\"year\",\"metrics\":[\"count\"]}"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"slice_name": "2 - Sample chart",
|
"slice_name": "2 - Sample chart",
|
||||||
"description": "chart description",
|
"description": "chart description",
|
||||||
"owners": [1],
|
"owners": [1],
|
||||||
"viz_type": "line",
|
"viz_type": "echarts_timeseries_line",
|
||||||
"cache_timeout": 1000,
|
"cache_timeout": 1000,
|
||||||
"datasource_id": 2,
|
"datasource_id": 2,
|
||||||
"datasource_type": "table",
|
"datasource_type": "table",
|
||||||
"params": "{\"viz_type\":\"line\",\"metrics\":[\"count\"]}"
|
"params": "{\"viz_type\":\"echarts_timeseries_line\",\"x_axis\":\"year\",\"metrics\":[\"count\"]}"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"slice_name": "3 - Sample chart",
|
"slice_name": "3 - Sample chart",
|
||||||
"description": "chart description",
|
"description": "chart description",
|
||||||
"owners": [1],
|
"owners": [1],
|
||||||
"viz_type": "line",
|
"viz_type": "echarts_timeseries_line",
|
||||||
"cache_timeout": 1000,
|
"cache_timeout": 1000,
|
||||||
"datasource_id": 2,
|
"datasource_id": 2,
|
||||||
"datasource_type": "table",
|
"datasource_type": "table",
|
||||||
"params": "{\"viz_type\":\"line\",\"metrics\":[\"count\"]}"
|
"params": "{\"viz_type\":\"echarts_timeseries_line\",\"x_axis\":\"year\",\"metrics\":[\"count\"]}"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"slice_name": "4 - Sample chart",
|
"slice_name": "4 - Sample chart",
|
||||||
"description": "chart description",
|
"description": "chart description",
|
||||||
"owners": [1],
|
"owners": [1],
|
||||||
"viz_type": "line",
|
"viz_type": "echarts_timeseries_line",
|
||||||
"cache_timeout": 1000,
|
"cache_timeout": 1000,
|
||||||
"datasource_id": 2,
|
"datasource_id": 2,
|
||||||
"datasource_type": "table",
|
"datasource_type": "table",
|
||||||
"params": "{\"viz_type\":\"line\",\"metrics\":[\"count\"]}"
|
"params": "{\"viz_type\":\"echarts_timeseries_line\",\"x_axis\":\"year\",\"metrics\":[\"count\"]}"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -30,17 +30,12 @@
|
||||||
"@superset-ui/legacy-plugin-chart-calendar": "file:./plugins/legacy-plugin-chart-calendar",
|
"@superset-ui/legacy-plugin-chart-calendar": "file:./plugins/legacy-plugin-chart-calendar",
|
||||||
"@superset-ui/legacy-plugin-chart-chord": "file:./plugins/legacy-plugin-chart-chord",
|
"@superset-ui/legacy-plugin-chart-chord": "file:./plugins/legacy-plugin-chart-chord",
|
||||||
"@superset-ui/legacy-plugin-chart-country-map": "file:./plugins/legacy-plugin-chart-country-map",
|
"@superset-ui/legacy-plugin-chart-country-map": "file:./plugins/legacy-plugin-chart-country-map",
|
||||||
"@superset-ui/legacy-plugin-chart-event-flow": "file:./plugins/legacy-plugin-chart-event-flow",
|
|
||||||
"@superset-ui/legacy-plugin-chart-heatmap": "file:./plugins/legacy-plugin-chart-heatmap",
|
|
||||||
"@superset-ui/legacy-plugin-chart-histogram": "file:./plugins/legacy-plugin-chart-histogram",
|
|
||||||
"@superset-ui/legacy-plugin-chart-horizon": "file:./plugins/legacy-plugin-chart-horizon",
|
"@superset-ui/legacy-plugin-chart-horizon": "file:./plugins/legacy-plugin-chart-horizon",
|
||||||
"@superset-ui/legacy-plugin-chart-map-box": "file:./plugins/legacy-plugin-chart-map-box",
|
"@superset-ui/legacy-plugin-chart-map-box": "file:./plugins/legacy-plugin-chart-map-box",
|
||||||
"@superset-ui/legacy-plugin-chart-paired-t-test": "file:./plugins/legacy-plugin-chart-paired-t-test",
|
"@superset-ui/legacy-plugin-chart-paired-t-test": "file:./plugins/legacy-plugin-chart-paired-t-test",
|
||||||
"@superset-ui/legacy-plugin-chart-parallel-coordinates": "file:./plugins/legacy-plugin-chart-parallel-coordinates",
|
"@superset-ui/legacy-plugin-chart-parallel-coordinates": "file:./plugins/legacy-plugin-chart-parallel-coordinates",
|
||||||
"@superset-ui/legacy-plugin-chart-partition": "file:./plugins/legacy-plugin-chart-partition",
|
"@superset-ui/legacy-plugin-chart-partition": "file:./plugins/legacy-plugin-chart-partition",
|
||||||
"@superset-ui/legacy-plugin-chart-rose": "file:./plugins/legacy-plugin-chart-rose",
|
"@superset-ui/legacy-plugin-chart-rose": "file:./plugins/legacy-plugin-chart-rose",
|
||||||
"@superset-ui/legacy-plugin-chart-sankey": "file:./plugins/legacy-plugin-chart-sankey",
|
|
||||||
"@superset-ui/legacy-plugin-chart-sankey-loop": "file:./plugins/legacy-plugin-chart-sankey-loop",
|
|
||||||
"@superset-ui/legacy-plugin-chart-world-map": "file:./plugins/legacy-plugin-chart-world-map",
|
"@superset-ui/legacy-plugin-chart-world-map": "file:./plugins/legacy-plugin-chart-world-map",
|
||||||
"@superset-ui/legacy-preset-chart-deckgl": "file:./plugins/legacy-preset-chart-deckgl",
|
"@superset-ui/legacy-preset-chart-deckgl": "file:./plugins/legacy-preset-chart-deckgl",
|
||||||
"@superset-ui/legacy-preset-chart-nvd3": "file:./plugins/legacy-preset-chart-nvd3",
|
"@superset-ui/legacy-preset-chart-nvd3": "file:./plugins/legacy-preset-chart-nvd3",
|
||||||
|
|
@ -3812,206 +3807,6 @@
|
||||||
"react-dom": "^0.14.9 || ^15.3.0 || ^16.0.0-rc || ^16.0"
|
"react-dom": "^0.14.9 || ^15.3.0 || ^16.0.0-rc || ^16.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@data-ui/histogram": {
|
|
||||||
"version": "0.0.84",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@data-ui/shared": "^0.0.84",
|
|
||||||
"@data-ui/theme": "^0.0.84",
|
|
||||||
"@vx/axis": "^0.0.179",
|
|
||||||
"@vx/curve": "^0.0.165",
|
|
||||||
"@vx/event": "^0.0.179",
|
|
||||||
"@vx/glyph": "^0.0.179",
|
|
||||||
"@vx/gradient": "^0.0.165",
|
|
||||||
"@vx/group": "^0.0.170",
|
|
||||||
"@vx/pattern": "^0.0.179",
|
|
||||||
"@vx/responsive": "^0.0.192",
|
|
||||||
"@vx/scale": "^0.0.179",
|
|
||||||
"@vx/shape": "^0.0.179",
|
|
||||||
"@vx/tooltip": "0.0.179",
|
|
||||||
"d3-array": "^1.2.0",
|
|
||||||
"d3-scale": "^1.0.6",
|
|
||||||
"prop-types": "^15.5.10",
|
|
||||||
"react-move": "^2.1.0"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"react": "^15.0.0-0 || ^16.0.0-0",
|
|
||||||
"react-dom": "^15.0.0-0 || ^16.0.0-0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@data-ui/histogram/node_modules/@vx/axis": {
|
|
||||||
"version": "0.0.179",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@vx/group": "0.0.170",
|
|
||||||
"@vx/point": "0.0.165",
|
|
||||||
"@vx/shape": "0.0.179",
|
|
||||||
"@vx/text": "0.0.179",
|
|
||||||
"classnames": "^2.2.5",
|
|
||||||
"prop-types": "^15.6.0"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"react": "^15.0.0-0 || ^16.0.0-0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@data-ui/histogram/node_modules/@vx/bounds": {
|
|
||||||
"version": "0.0.165",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"prop-types": "^15.5.10"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"react": "^15.0.0-0 || ^16.0.0-0",
|
|
||||||
"react-dom": "^15.0.0-0 || ^16.0.0-0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@data-ui/histogram/node_modules/@vx/event": {
|
|
||||||
"version": "0.0.179",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@vx/point": "0.0.165"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@data-ui/histogram/node_modules/@vx/glyph": {
|
|
||||||
"version": "0.0.179",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@vx/group": "0.0.170",
|
|
||||||
"classnames": "^2.2.5",
|
|
||||||
"d3-shape": "^1.2.0",
|
|
||||||
"prop-types": "^15.6.2"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"react": "^15.0.0-0 || ^16.0.0-0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@data-ui/histogram/node_modules/@vx/gradient": {
|
|
||||||
"version": "0.0.165",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"classnames": "^2.2.5",
|
|
||||||
"prop-types": "^15.5.7"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"react": "^15.0.0-0 || ^16.0.0-0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@data-ui/histogram/node_modules/@vx/group": {
|
|
||||||
"version": "0.0.170",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"classnames": "^2.2.5"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"react": "^15.0.0-0 || ^16.0.0-0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@data-ui/histogram/node_modules/@vx/pattern": {
|
|
||||||
"version": "0.0.179",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"classnames": "^2.2.5",
|
|
||||||
"prop-types": "^15.5.10"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"react": "^15.0.0-0 || ^16.0.0-0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@data-ui/histogram/node_modules/@vx/point": {
|
|
||||||
"version": "0.0.165",
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
|
||||||
"node_modules/@data-ui/histogram/node_modules/@vx/responsive": {
|
|
||||||
"version": "0.0.192",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"lodash": "^4.17.10",
|
|
||||||
"prop-types": "^15.6.1",
|
|
||||||
"resize-observer-polyfill": "1.5.0"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"react": "^15.0.0-0 || ^16.0.0-0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@data-ui/histogram/node_modules/@vx/scale": {
|
|
||||||
"version": "0.0.179",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"d3-scale": "^2.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@data-ui/histogram/node_modules/@vx/scale/node_modules/d3-scale": {
|
|
||||||
"version": "2.2.2",
|
|
||||||
"license": "BSD-3-Clause",
|
|
||||||
"dependencies": {
|
|
||||||
"d3-array": "^1.2.0",
|
|
||||||
"d3-collection": "1",
|
|
||||||
"d3-format": "1",
|
|
||||||
"d3-interpolate": "1",
|
|
||||||
"d3-time": "1",
|
|
||||||
"d3-time-format": "2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@data-ui/histogram/node_modules/@vx/shape": {
|
|
||||||
"version": "0.0.179",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@vx/curve": "0.0.165",
|
|
||||||
"@vx/group": "0.0.170",
|
|
||||||
"@vx/point": "0.0.165",
|
|
||||||
"classnames": "^2.2.5",
|
|
||||||
"d3-path": "^1.0.5",
|
|
||||||
"d3-shape": "^1.2.0",
|
|
||||||
"prop-types": "^15.5.10"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"react": "^15.0.0-0 || ^16.0.0-0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@data-ui/histogram/node_modules/@vx/tooltip": {
|
|
||||||
"version": "0.0.179",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@vx/bounds": "0.0.165",
|
|
||||||
"classnames": "^2.2.5",
|
|
||||||
"prop-types": "^15.5.10"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"react": "^15.0.0-0 || ^16.0.0-0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@data-ui/histogram/node_modules/d3-interpolate": {
|
|
||||||
"version": "1.4.0",
|
|
||||||
"license": "BSD-3-Clause",
|
|
||||||
"dependencies": {
|
|
||||||
"d3-color": "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@data-ui/histogram/node_modules/d3-scale": {
|
|
||||||
"version": "1.0.7",
|
|
||||||
"license": "BSD-3-Clause",
|
|
||||||
"dependencies": {
|
|
||||||
"d3-array": "^1.2.0",
|
|
||||||
"d3-collection": "1",
|
|
||||||
"d3-color": "1",
|
|
||||||
"d3-format": "1",
|
|
||||||
"d3-interpolate": "1",
|
|
||||||
"d3-time": "1",
|
|
||||||
"d3-time-format": "2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@data-ui/histogram/node_modules/d3-time-format": {
|
|
||||||
"version": "2.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-2.3.0.tgz",
|
|
||||||
"integrity": "sha512-guv6b2H37s2Uq/GefleCDtbe0XZAuy7Wa49VGkPVPMfLL9qObgBST3lEHJBMUp8S7NdLQAGIvr2KXk8Hc98iKQ==",
|
|
||||||
"dependencies": {
|
|
||||||
"d3-time": "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@data-ui/histogram/node_modules/resize-observer-polyfill": {
|
|
||||||
"version": "1.5.0",
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
|
||||||
"node_modules/@data-ui/radial-chart": {
|
"node_modules/@data-ui/radial-chart": {
|
||||||
"version": "0.0.84",
|
"version": "0.0.84",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|
@ -12363,18 +12158,6 @@
|
||||||
"resolved": "plugins/legacy-plugin-chart-country-map",
|
"resolved": "plugins/legacy-plugin-chart-country-map",
|
||||||
"link": true
|
"link": true
|
||||||
},
|
},
|
||||||
"node_modules/@superset-ui/legacy-plugin-chart-event-flow": {
|
|
||||||
"resolved": "plugins/legacy-plugin-chart-event-flow",
|
|
||||||
"link": true
|
|
||||||
},
|
|
||||||
"node_modules/@superset-ui/legacy-plugin-chart-heatmap": {
|
|
||||||
"resolved": "plugins/legacy-plugin-chart-heatmap",
|
|
||||||
"link": true
|
|
||||||
},
|
|
||||||
"node_modules/@superset-ui/legacy-plugin-chart-histogram": {
|
|
||||||
"resolved": "plugins/legacy-plugin-chart-histogram",
|
|
||||||
"link": true
|
|
||||||
},
|
|
||||||
"node_modules/@superset-ui/legacy-plugin-chart-horizon": {
|
"node_modules/@superset-ui/legacy-plugin-chart-horizon": {
|
||||||
"resolved": "plugins/legacy-plugin-chart-horizon",
|
"resolved": "plugins/legacy-plugin-chart-horizon",
|
||||||
"link": true
|
"link": true
|
||||||
|
|
@ -12399,14 +12182,6 @@
|
||||||
"resolved": "plugins/legacy-plugin-chart-rose",
|
"resolved": "plugins/legacy-plugin-chart-rose",
|
||||||
"link": true
|
"link": true
|
||||||
},
|
},
|
||||||
"node_modules/@superset-ui/legacy-plugin-chart-sankey": {
|
|
||||||
"resolved": "plugins/legacy-plugin-chart-sankey",
|
|
||||||
"link": true
|
|
||||||
},
|
|
||||||
"node_modules/@superset-ui/legacy-plugin-chart-sankey-loop": {
|
|
||||||
"resolved": "plugins/legacy-plugin-chart-sankey-loop",
|
|
||||||
"link": true
|
|
||||||
},
|
|
||||||
"node_modules/@superset-ui/legacy-plugin-chart-time-table": {
|
"node_modules/@superset-ui/legacy-plugin-chart-time-table": {
|
||||||
"version": "0.18.25",
|
"version": "0.18.25",
|
||||||
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-time-table/-/legacy-plugin-chart-time-table-0.18.25.tgz",
|
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-time-table/-/legacy-plugin-chart-time-table-0.18.25.tgz",
|
||||||
|
|
@ -15322,69 +15097,6 @@
|
||||||
"react": "^15.0.0-0 || ^16.0.0-0"
|
"react": "^15.0.0-0 || ^16.0.0-0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@vx/scale": {
|
|
||||||
"version": "0.0.199",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@types/d3-interpolate": "^1.3.1",
|
|
||||||
"@types/d3-scale": "^2.1.1",
|
|
||||||
"@types/d3-time": "^1.0.10",
|
|
||||||
"d3-interpolate": "^1.4.0",
|
|
||||||
"d3-scale": "^3.0.1",
|
|
||||||
"d3-time": "^1.1.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@vx/scale/node_modules/@types/d3-interpolate": {
|
|
||||||
"version": "1.4.5",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@types/d3-color": "^1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@vx/scale/node_modules/d3-array": {
|
|
||||||
"version": "2.12.1",
|
|
||||||
"license": "BSD-3-Clause",
|
|
||||||
"dependencies": {
|
|
||||||
"internmap": "^1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@vx/scale/node_modules/d3-interpolate": {
|
|
||||||
"version": "1.4.0",
|
|
||||||
"license": "BSD-3-Clause",
|
|
||||||
"dependencies": {
|
|
||||||
"d3-color": "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@vx/scale/node_modules/d3-scale": {
|
|
||||||
"version": "3.3.0",
|
|
||||||
"license": "BSD-3-Clause",
|
|
||||||
"dependencies": {
|
|
||||||
"d3-array": "^2.3.0",
|
|
||||||
"d3-format": "1 - 2",
|
|
||||||
"d3-interpolate": "1.2.0 - 2",
|
|
||||||
"d3-time": "^2.1.1",
|
|
||||||
"d3-time-format": "2 - 3"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@vx/scale/node_modules/d3-scale/node_modules/d3-time": {
|
|
||||||
"version": "2.1.1",
|
|
||||||
"license": "BSD-3-Clause",
|
|
||||||
"dependencies": {
|
|
||||||
"d3-array": "2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@vx/scale/node_modules/d3-time": {
|
|
||||||
"version": "1.1.0",
|
|
||||||
"license": "BSD-3-Clause"
|
|
||||||
},
|
|
||||||
"node_modules/@vx/scale/node_modules/d3-time-format": {
|
|
||||||
"version": "3.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-3.0.0.tgz",
|
|
||||||
"integrity": "sha512-UXJh6EKsHBTjopVqZBhFysQcoXSv/5yLONZvkQ5Kk3qbwiUYkdX17Xa1PT6U1ZWXGGfB1ey5L8dKMlFq2DO0Ag==",
|
|
||||||
"dependencies": {
|
|
||||||
"d3-time": "1 - 2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@vx/shape": {
|
"node_modules/@vx/shape": {
|
||||||
"version": "0.0.140",
|
"version": "0.0.140",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|
@ -15440,6 +15152,7 @@
|
||||||
"node_modules/@vx/text": {
|
"node_modules/@vx/text": {
|
||||||
"version": "0.0.179",
|
"version": "0.0.179",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"babel-plugin-lodash": "^3.3.2",
|
"babel-plugin-lodash": "^3.3.2",
|
||||||
"classnames": "^2.2.5",
|
"classnames": "^2.2.5",
|
||||||
|
|
@ -21491,47 +21204,6 @@
|
||||||
"version": "2.0.3",
|
"version": "2.0.3",
|
||||||
"license": "BSD-3-Clause"
|
"license": "BSD-3-Clause"
|
||||||
},
|
},
|
||||||
"node_modules/d3-sankey": {
|
|
||||||
"version": "0.4.2",
|
|
||||||
"license": "BSD-3-Clause",
|
|
||||||
"dependencies": {
|
|
||||||
"d3-array": "1",
|
|
||||||
"d3-collection": "1",
|
|
||||||
"d3-interpolate": "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/d3-sankey-diagram": {
|
|
||||||
"version": "0.7.3",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"d3-array": "^1.0.2",
|
|
||||||
"d3-collection": "^1.0.2",
|
|
||||||
"d3-dispatch": "^1.0.3",
|
|
||||||
"d3-format": "^1.1.1",
|
|
||||||
"d3-interpolate": "^1.1.3",
|
|
||||||
"d3-selection": "^1.0.3",
|
|
||||||
"d3-transition": "^1.0.4",
|
|
||||||
"graphlib": "~2.1.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/d3-sankey-diagram/node_modules/d3-interpolate": {
|
|
||||||
"version": "1.4.0",
|
|
||||||
"license": "BSD-3-Clause",
|
|
||||||
"dependencies": {
|
|
||||||
"d3-color": "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/d3-sankey-diagram/node_modules/d3-selection": {
|
|
||||||
"version": "1.4.2",
|
|
||||||
"license": "BSD-3-Clause"
|
|
||||||
},
|
|
||||||
"node_modules/d3-sankey/node_modules/d3-interpolate": {
|
|
||||||
"version": "1.4.0",
|
|
||||||
"license": "BSD-3-Clause",
|
|
||||||
"dependencies": {
|
|
||||||
"d3-color": "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/d3-scale": {
|
"node_modules/d3-scale": {
|
||||||
"version": "2.2.2",
|
"version": "2.2.2",
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
|
|
@ -21588,13 +21260,6 @@
|
||||||
"d3-path": "1"
|
"d3-path": "1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/d3-svg-legend": {
|
|
||||||
"version": "1.13.0",
|
|
||||||
"license": "ISC",
|
|
||||||
"peerDependencies": {
|
|
||||||
"d3": "^3.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/d3-time": {
|
"node_modules/d3-time": {
|
||||||
"version": "1.0.10",
|
"version": "1.0.10",
|
||||||
"license": "BSD-3-Clause"
|
"license": "BSD-3-Clause"
|
||||||
|
|
@ -28135,13 +27800,6 @@
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/graphlib": {
|
|
||||||
"version": "2.1.8",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"lodash": "^4.17.15"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/grid-index": {
|
"node_modules/grid-index": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
|
|
@ -46428,27 +46086,6 @@
|
||||||
"url": "https://github.com/sponsors/wooorm"
|
"url": "https://github.com/sponsors/wooorm"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/react-move": {
|
|
||||||
"version": "2.9.1",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@babel/runtime": "^7.2.0",
|
|
||||||
"d3-interpolate": "^1.3.2",
|
|
||||||
"d3-timer": "^1.0.9",
|
|
||||||
"prop-types": "^15.6.2",
|
|
||||||
"react-lifecycles-compat": "^3.0.4"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"react": "^15.4.0 || ^16.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/react-move/node_modules/d3-interpolate": {
|
|
||||||
"version": "1.4.0",
|
|
||||||
"license": "BSD-3-Clause",
|
|
||||||
"dependencies": {
|
|
||||||
"d3-color": "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/react-redux": {
|
"node_modules/react-redux": {
|
||||||
"version": "7.2.9",
|
"version": "7.2.9",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|
@ -57165,17 +56802,12 @@
|
||||||
"@superset-ui/legacy-plugin-chart-calendar": "*",
|
"@superset-ui/legacy-plugin-chart-calendar": "*",
|
||||||
"@superset-ui/legacy-plugin-chart-chord": "*",
|
"@superset-ui/legacy-plugin-chart-chord": "*",
|
||||||
"@superset-ui/legacy-plugin-chart-country-map": "*",
|
"@superset-ui/legacy-plugin-chart-country-map": "*",
|
||||||
"@superset-ui/legacy-plugin-chart-event-flow": "*",
|
|
||||||
"@superset-ui/legacy-plugin-chart-heatmap": "*",
|
|
||||||
"@superset-ui/legacy-plugin-chart-histogram": "*",
|
|
||||||
"@superset-ui/legacy-plugin-chart-horizon": "*",
|
"@superset-ui/legacy-plugin-chart-horizon": "*",
|
||||||
"@superset-ui/legacy-plugin-chart-map-box": "*",
|
"@superset-ui/legacy-plugin-chart-map-box": "*",
|
||||||
"@superset-ui/legacy-plugin-chart-paired-t-test": "*",
|
"@superset-ui/legacy-plugin-chart-paired-t-test": "*",
|
||||||
"@superset-ui/legacy-plugin-chart-parallel-coordinates": "*",
|
"@superset-ui/legacy-plugin-chart-parallel-coordinates": "*",
|
||||||
"@superset-ui/legacy-plugin-chart-partition": "*",
|
"@superset-ui/legacy-plugin-chart-partition": "*",
|
||||||
"@superset-ui/legacy-plugin-chart-rose": "*",
|
"@superset-ui/legacy-plugin-chart-rose": "*",
|
||||||
"@superset-ui/legacy-plugin-chart-sankey": "*",
|
|
||||||
"@superset-ui/legacy-plugin-chart-sankey-loop": "*",
|
|
||||||
"@superset-ui/legacy-plugin-chart-time-table": "*",
|
"@superset-ui/legacy-plugin-chart-time-table": "*",
|
||||||
"@superset-ui/legacy-plugin-chart-world-map": "*",
|
"@superset-ui/legacy-plugin-chart-world-map": "*",
|
||||||
"@superset-ui/legacy-preset-chart-deckgl": "*",
|
"@superset-ui/legacy-preset-chart-deckgl": "*",
|
||||||
|
|
@ -58688,6 +58320,7 @@
|
||||||
"plugins/legacy-plugin-chart-event-flow": {
|
"plugins/legacy-plugin-chart-event-flow": {
|
||||||
"name": "@superset-ui/legacy-plugin-chart-event-flow",
|
"name": "@superset-ui/legacy-plugin-chart-event-flow",
|
||||||
"version": "0.20.3",
|
"version": "0.20.3",
|
||||||
|
"extraneous": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@data-ui/event-flow": "^0.0.84",
|
"@data-ui/event-flow": "^0.0.84",
|
||||||
|
|
@ -58702,6 +58335,7 @@
|
||||||
"plugins/legacy-plugin-chart-heatmap": {
|
"plugins/legacy-plugin-chart-heatmap": {
|
||||||
"name": "@superset-ui/legacy-plugin-chart-heatmap",
|
"name": "@superset-ui/legacy-plugin-chart-heatmap",
|
||||||
"version": "0.20.3",
|
"version": "0.20.3",
|
||||||
|
"extraneous": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"d3": "^3.5.17",
|
"d3": "^3.5.17",
|
||||||
|
|
@ -58719,6 +58353,7 @@
|
||||||
"plugins/legacy-plugin-chart-histogram": {
|
"plugins/legacy-plugin-chart-histogram": {
|
||||||
"name": "@superset-ui/legacy-plugin-chart-histogram",
|
"name": "@superset-ui/legacy-plugin-chart-histogram",
|
||||||
"version": "0.20.3",
|
"version": "0.20.3",
|
||||||
|
"extraneous": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@data-ui/histogram": "^0.0.84",
|
"@data-ui/histogram": "^0.0.84",
|
||||||
|
|
@ -58734,34 +58369,6 @@
|
||||||
"react": "^15 || ^16"
|
"react": "^15 || ^16"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"plugins/legacy-plugin-chart-histogram/node_modules/@vx/group": {
|
|
||||||
"version": "0.0.199",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@types/classnames": "^2.2.9",
|
|
||||||
"@types/react": "*",
|
|
||||||
"classnames": "^2.2.5",
|
|
||||||
"prop-types": "^15.6.2"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"react": "^15.0.0-0 || ^16.0.0-0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"plugins/legacy-plugin-chart-histogram/node_modules/@vx/legend": {
|
|
||||||
"version": "0.0.199",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@types/classnames": "^2.2.9",
|
|
||||||
"@types/react": "*",
|
|
||||||
"@vx/group": "0.0.199",
|
|
||||||
"@vx/scale": "0.0.199",
|
|
||||||
"classnames": "^2.2.5",
|
|
||||||
"prop-types": "^15.5.10"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"react": "^16.3.0-0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"plugins/legacy-plugin-chart-horizon": {
|
"plugins/legacy-plugin-chart-horizon": {
|
||||||
"name": "@superset-ui/legacy-plugin-chart-horizon",
|
"name": "@superset-ui/legacy-plugin-chart-horizon",
|
||||||
"version": "0.20.3",
|
"version": "0.20.3",
|
||||||
|
|
@ -58926,6 +58533,7 @@
|
||||||
"plugins/legacy-plugin-chart-sankey": {
|
"plugins/legacy-plugin-chart-sankey": {
|
||||||
"name": "@superset-ui/legacy-plugin-chart-sankey",
|
"name": "@superset-ui/legacy-plugin-chart-sankey",
|
||||||
"version": "0.20.3",
|
"version": "0.20.3",
|
||||||
|
"extraneous": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"d3": "^3.5.17",
|
"d3": "^3.5.17",
|
||||||
|
|
@ -58941,6 +58549,7 @@
|
||||||
"plugins/legacy-plugin-chart-sankey-loop": {
|
"plugins/legacy-plugin-chart-sankey-loop": {
|
||||||
"name": "@superset-ui/legacy-plugin-chart-sankey-loop",
|
"name": "@superset-ui/legacy-plugin-chart-sankey-loop",
|
||||||
"version": "0.20.3",
|
"version": "0.20.3",
|
||||||
|
"extraneous": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"d3-sankey-diagram": "^0.7.3",
|
"d3-sankey-diagram": "^0.7.3",
|
||||||
|
|
@ -61783,161 +61392,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@data-ui/histogram": {
|
|
||||||
"version": "0.0.84",
|
|
||||||
"requires": {
|
|
||||||
"@data-ui/shared": "^0.0.84",
|
|
||||||
"@data-ui/theme": "^0.0.84",
|
|
||||||
"@vx/axis": "^0.0.179",
|
|
||||||
"@vx/curve": "^0.0.165",
|
|
||||||
"@vx/event": "^0.0.179",
|
|
||||||
"@vx/glyph": "^0.0.179",
|
|
||||||
"@vx/gradient": "^0.0.165",
|
|
||||||
"@vx/group": "^0.0.170",
|
|
||||||
"@vx/pattern": "^0.0.179",
|
|
||||||
"@vx/responsive": "^0.0.192",
|
|
||||||
"@vx/scale": "^0.0.179",
|
|
||||||
"@vx/shape": "^0.0.179",
|
|
||||||
"@vx/tooltip": "0.0.179",
|
|
||||||
"d3-array": "^1.2.0",
|
|
||||||
"d3-scale": "^1.0.6",
|
|
||||||
"prop-types": "^15.5.10",
|
|
||||||
"react-move": "^2.1.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@vx/axis": {
|
|
||||||
"version": "0.0.179",
|
|
||||||
"requires": {
|
|
||||||
"@vx/group": "0.0.170",
|
|
||||||
"@vx/point": "0.0.165",
|
|
||||||
"@vx/shape": "0.0.179",
|
|
||||||
"@vx/text": "0.0.179",
|
|
||||||
"classnames": "^2.2.5",
|
|
||||||
"prop-types": "^15.6.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@vx/bounds": {
|
|
||||||
"version": "0.0.165",
|
|
||||||
"requires": {
|
|
||||||
"prop-types": "^15.5.10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@vx/event": {
|
|
||||||
"version": "0.0.179",
|
|
||||||
"requires": {
|
|
||||||
"@vx/point": "0.0.165"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@vx/glyph": {
|
|
||||||
"version": "0.0.179",
|
|
||||||
"requires": {
|
|
||||||
"@vx/group": "0.0.170",
|
|
||||||
"classnames": "^2.2.5",
|
|
||||||
"d3-shape": "^1.2.0",
|
|
||||||
"prop-types": "^15.6.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@vx/gradient": {
|
|
||||||
"version": "0.0.165",
|
|
||||||
"requires": {
|
|
||||||
"classnames": "^2.2.5",
|
|
||||||
"prop-types": "^15.5.7"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@vx/group": {
|
|
||||||
"version": "0.0.170",
|
|
||||||
"requires": {
|
|
||||||
"classnames": "^2.2.5"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@vx/pattern": {
|
|
||||||
"version": "0.0.179",
|
|
||||||
"requires": {
|
|
||||||
"classnames": "^2.2.5",
|
|
||||||
"prop-types": "^15.5.10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@vx/point": {
|
|
||||||
"version": "0.0.165"
|
|
||||||
},
|
|
||||||
"@vx/responsive": {
|
|
||||||
"version": "0.0.192",
|
|
||||||
"requires": {
|
|
||||||
"lodash": "^4.17.10",
|
|
||||||
"prop-types": "^15.6.1",
|
|
||||||
"resize-observer-polyfill": "1.5.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@vx/scale": {
|
|
||||||
"version": "0.0.179",
|
|
||||||
"requires": {
|
|
||||||
"d3-scale": "^2.0.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"d3-scale": {
|
|
||||||
"version": "2.2.2",
|
|
||||||
"requires": {
|
|
||||||
"d3-array": "^1.2.0",
|
|
||||||
"d3-collection": "1",
|
|
||||||
"d3-format": "1",
|
|
||||||
"d3-interpolate": "1",
|
|
||||||
"d3-time": "1",
|
|
||||||
"d3-time-format": "2"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@vx/shape": {
|
|
||||||
"version": "0.0.179",
|
|
||||||
"requires": {
|
|
||||||
"@vx/curve": "0.0.165",
|
|
||||||
"@vx/group": "0.0.170",
|
|
||||||
"@vx/point": "0.0.165",
|
|
||||||
"classnames": "^2.2.5",
|
|
||||||
"d3-path": "^1.0.5",
|
|
||||||
"d3-shape": "^1.2.0",
|
|
||||||
"prop-types": "^15.5.10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@vx/tooltip": {
|
|
||||||
"version": "0.0.179",
|
|
||||||
"requires": {
|
|
||||||
"@vx/bounds": "0.0.165",
|
|
||||||
"classnames": "^2.2.5",
|
|
||||||
"prop-types": "^15.5.10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"d3-interpolate": {
|
|
||||||
"version": "1.4.0",
|
|
||||||
"requires": {
|
|
||||||
"d3-color": "^3.1.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"d3-scale": {
|
|
||||||
"version": "1.0.7",
|
|
||||||
"requires": {
|
|
||||||
"d3-array": "^1.2.0",
|
|
||||||
"d3-collection": "1",
|
|
||||||
"d3-color": "^3.1.0",
|
|
||||||
"d3-format": "1",
|
|
||||||
"d3-interpolate": "1",
|
|
||||||
"d3-time": "1",
|
|
||||||
"d3-time-format": "2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"d3-time-format": {
|
|
||||||
"version": "2.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-2.3.0.tgz",
|
|
||||||
"integrity": "sha512-guv6b2H37s2Uq/GefleCDtbe0XZAuy7Wa49VGkPVPMfLL9qObgBST3lEHJBMUp8S7NdLQAGIvr2KXk8Hc98iKQ==",
|
|
||||||
"requires": {
|
|
||||||
"d3-time": "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"resize-observer-polyfill": {
|
|
||||||
"version": "1.5.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@data-ui/radial-chart": {
|
"@data-ui/radial-chart": {
|
||||||
"version": "0.0.84",
|
"version": "0.0.84",
|
||||||
"requires": {
|
"requires": {
|
||||||
|
|
@ -69622,55 +69076,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@superset-ui/legacy-plugin-chart-event-flow": {
|
|
||||||
"version": "file:plugins/legacy-plugin-chart-event-flow",
|
|
||||||
"requires": {
|
|
||||||
"@data-ui/event-flow": "^0.0.84",
|
|
||||||
"prop-types": "^15.8.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@superset-ui/legacy-plugin-chart-heatmap": {
|
|
||||||
"version": "file:plugins/legacy-plugin-chart-heatmap",
|
|
||||||
"requires": {
|
|
||||||
"d3": "^3.5.17",
|
|
||||||
"d3-svg-legend": "^1.x",
|
|
||||||
"d3-tip": "^0.9.1",
|
|
||||||
"prop-types": "^15.8.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@superset-ui/legacy-plugin-chart-histogram": {
|
|
||||||
"version": "file:plugins/legacy-plugin-chart-histogram",
|
|
||||||
"requires": {
|
|
||||||
"@data-ui/histogram": "^0.0.84",
|
|
||||||
"@data-ui/theme": "^0.0.84",
|
|
||||||
"@vx/legend": "^0.0.199",
|
|
||||||
"@vx/responsive": "^0.0.199",
|
|
||||||
"@vx/scale": "^0.0.199",
|
|
||||||
"prop-types": "^15.8.1"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@vx/group": {
|
|
||||||
"version": "0.0.199",
|
|
||||||
"requires": {
|
|
||||||
"@types/classnames": "^2.2.9",
|
|
||||||
"@types/react": "*",
|
|
||||||
"classnames": "^2.2.5",
|
|
||||||
"prop-types": "^15.6.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@vx/legend": {
|
|
||||||
"version": "0.0.199",
|
|
||||||
"requires": {
|
|
||||||
"@types/classnames": "^2.2.9",
|
|
||||||
"@types/react": "*",
|
|
||||||
"@vx/group": "0.0.199",
|
|
||||||
"@vx/scale": "0.0.199",
|
|
||||||
"classnames": "^2.2.5",
|
|
||||||
"prop-types": "^15.5.10"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@superset-ui/legacy-plugin-chart-horizon": {
|
"@superset-ui/legacy-plugin-chart-horizon": {
|
||||||
"version": "file:plugins/legacy-plugin-chart-horizon",
|
"version": "file:plugins/legacy-plugin-chart-horizon",
|
||||||
"requires": {
|
"requires": {
|
||||||
|
|
@ -69783,22 +69188,6 @@
|
||||||
"prop-types": "^15.8.1"
|
"prop-types": "^15.8.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@superset-ui/legacy-plugin-chart-sankey": {
|
|
||||||
"version": "file:plugins/legacy-plugin-chart-sankey",
|
|
||||||
"requires": {
|
|
||||||
"d3": "^3.5.17",
|
|
||||||
"d3-sankey": "^0.4.2",
|
|
||||||
"prop-types": "^15.8.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@superset-ui/legacy-plugin-chart-sankey-loop": {
|
|
||||||
"version": "file:plugins/legacy-plugin-chart-sankey-loop",
|
|
||||||
"requires": {
|
|
||||||
"d3-sankey-diagram": "^0.7.3",
|
|
||||||
"d3-selection": "^3.0.0",
|
|
||||||
"prop-types": "^15.8.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@superset-ui/legacy-plugin-chart-time-table": {
|
"@superset-ui/legacy-plugin-chart-time-table": {
|
||||||
"version": "0.18.25",
|
"version": "0.18.25",
|
||||||
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-time-table/-/legacy-plugin-chart-time-table-0.18.25.tgz",
|
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-time-table/-/legacy-plugin-chart-time-table-0.18.25.tgz",
|
||||||
|
|
@ -72244,66 +71633,6 @@
|
||||||
"resize-observer-polyfill": "1.5.1"
|
"resize-observer-polyfill": "1.5.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@vx/scale": {
|
|
||||||
"version": "0.0.199",
|
|
||||||
"requires": {
|
|
||||||
"@types/d3-interpolate": "^1.3.1",
|
|
||||||
"@types/d3-scale": "^2.1.1",
|
|
||||||
"@types/d3-time": "^1.0.10",
|
|
||||||
"d3-interpolate": "^1.4.0",
|
|
||||||
"d3-scale": "^3.0.1",
|
|
||||||
"d3-time": "^1.1.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@types/d3-interpolate": {
|
|
||||||
"version": "1.4.5",
|
|
||||||
"requires": {
|
|
||||||
"@types/d3-color": "^1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"d3-array": {
|
|
||||||
"version": "2.12.1",
|
|
||||||
"requires": {
|
|
||||||
"internmap": "^1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"d3-interpolate": {
|
|
||||||
"version": "1.4.0",
|
|
||||||
"requires": {
|
|
||||||
"d3-color": "^3.1.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"d3-scale": {
|
|
||||||
"version": "3.3.0",
|
|
||||||
"requires": {
|
|
||||||
"d3-array": "^2.3.0",
|
|
||||||
"d3-format": "1 - 2",
|
|
||||||
"d3-interpolate": "1.2.0 - 2",
|
|
||||||
"d3-time": "^2.1.1",
|
|
||||||
"d3-time-format": "2 - 3"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"d3-time": {
|
|
||||||
"version": "2.1.1",
|
|
||||||
"requires": {
|
|
||||||
"d3-array": "2"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"d3-time": {
|
|
||||||
"version": "1.1.0"
|
|
||||||
},
|
|
||||||
"d3-time-format": {
|
|
||||||
"version": "3.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-3.0.0.tgz",
|
|
||||||
"integrity": "sha512-UXJh6EKsHBTjopVqZBhFysQcoXSv/5yLONZvkQ5Kk3qbwiUYkdX17Xa1PT6U1ZWXGGfB1ey5L8dKMlFq2DO0Ag==",
|
|
||||||
"requires": {
|
|
||||||
"d3-time": "1 - 2"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@vx/shape": {
|
"@vx/shape": {
|
||||||
"version": "0.0.140",
|
"version": "0.0.140",
|
||||||
"requires": {
|
"requires": {
|
||||||
|
|
@ -72348,6 +71677,7 @@
|
||||||
},
|
},
|
||||||
"@vx/text": {
|
"@vx/text": {
|
||||||
"version": "0.0.179",
|
"version": "0.0.179",
|
||||||
|
"peer": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"babel-plugin-lodash": "^3.3.2",
|
"babel-plugin-lodash": "^3.3.2",
|
||||||
"classnames": "^2.2.5",
|
"classnames": "^2.2.5",
|
||||||
|
|
@ -76473,46 +75803,6 @@
|
||||||
"d3-queue": {
|
"d3-queue": {
|
||||||
"version": "2.0.3"
|
"version": "2.0.3"
|
||||||
},
|
},
|
||||||
"d3-sankey": {
|
|
||||||
"version": "0.4.2",
|
|
||||||
"requires": {
|
|
||||||
"d3-array": "1",
|
|
||||||
"d3-collection": "1",
|
|
||||||
"d3-interpolate": "1"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"d3-interpolate": {
|
|
||||||
"version": "1.4.0",
|
|
||||||
"requires": {
|
|
||||||
"d3-color": "^3.1.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"d3-sankey-diagram": {
|
|
||||||
"version": "0.7.3",
|
|
||||||
"requires": {
|
|
||||||
"d3-array": "^1.0.2",
|
|
||||||
"d3-collection": "^1.0.2",
|
|
||||||
"d3-dispatch": "^1.0.3",
|
|
||||||
"d3-format": "^1.1.1",
|
|
||||||
"d3-interpolate": "^1.1.3",
|
|
||||||
"d3-selection": "^1.0.3",
|
|
||||||
"d3-transition": "^1.0.4",
|
|
||||||
"graphlib": "~2.1.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"d3-interpolate": {
|
|
||||||
"version": "1.4.0",
|
|
||||||
"requires": {
|
|
||||||
"d3-color": "^3.1.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"d3-selection": {
|
|
||||||
"version": "1.4.2"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"d3-scale": {
|
"d3-scale": {
|
||||||
"version": "2.2.2",
|
"version": "2.2.2",
|
||||||
"requires": {
|
"requires": {
|
||||||
|
|
@ -76564,10 +75854,6 @@
|
||||||
"d3-path": "1"
|
"d3-path": "1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"d3-svg-legend": {
|
|
||||||
"version": "1.13.0",
|
|
||||||
"requires": {}
|
|
||||||
},
|
|
||||||
"d3-time": {
|
"d3-time": {
|
||||||
"version": "1.0.10"
|
"version": "1.0.10"
|
||||||
},
|
},
|
||||||
|
|
@ -80889,12 +80175,6 @@
|
||||||
"version": "1.4.0",
|
"version": "1.4.0",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"graphlib": {
|
|
||||||
"version": "2.1.8",
|
|
||||||
"requires": {
|
|
||||||
"lodash": "^4.17.15"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"grid-index": {
|
"grid-index": {
|
||||||
"version": "1.1.0"
|
"version": "1.1.0"
|
||||||
},
|
},
|
||||||
|
|
@ -92102,24 +91382,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"react-move": {
|
|
||||||
"version": "2.9.1",
|
|
||||||
"requires": {
|
|
||||||
"@babel/runtime": "^7.2.0",
|
|
||||||
"d3-interpolate": "^1.3.2",
|
|
||||||
"d3-timer": "^1.0.9",
|
|
||||||
"prop-types": "^15.6.2",
|
|
||||||
"react-lifecycles-compat": "^3.0.4"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"d3-interpolate": {
|
|
||||||
"version": "1.4.0",
|
|
||||||
"requires": {
|
|
||||||
"d3-color": "^3.1.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"react-redux": {
|
"react-redux": {
|
||||||
"version": "7.2.9",
|
"version": "7.2.9",
|
||||||
"requires": {
|
"requires": {
|
||||||
|
|
|
||||||
|
|
@ -97,17 +97,12 @@
|
||||||
"@superset-ui/legacy-plugin-chart-calendar": "file:./plugins/legacy-plugin-chart-calendar",
|
"@superset-ui/legacy-plugin-chart-calendar": "file:./plugins/legacy-plugin-chart-calendar",
|
||||||
"@superset-ui/legacy-plugin-chart-chord": "file:./plugins/legacy-plugin-chart-chord",
|
"@superset-ui/legacy-plugin-chart-chord": "file:./plugins/legacy-plugin-chart-chord",
|
||||||
"@superset-ui/legacy-plugin-chart-country-map": "file:./plugins/legacy-plugin-chart-country-map",
|
"@superset-ui/legacy-plugin-chart-country-map": "file:./plugins/legacy-plugin-chart-country-map",
|
||||||
"@superset-ui/legacy-plugin-chart-event-flow": "file:./plugins/legacy-plugin-chart-event-flow",
|
|
||||||
"@superset-ui/legacy-plugin-chart-heatmap": "file:./plugins/legacy-plugin-chart-heatmap",
|
|
||||||
"@superset-ui/legacy-plugin-chart-histogram": "file:./plugins/legacy-plugin-chart-histogram",
|
|
||||||
"@superset-ui/legacy-plugin-chart-horizon": "file:./plugins/legacy-plugin-chart-horizon",
|
"@superset-ui/legacy-plugin-chart-horizon": "file:./plugins/legacy-plugin-chart-horizon",
|
||||||
"@superset-ui/legacy-plugin-chart-map-box": "file:./plugins/legacy-plugin-chart-map-box",
|
"@superset-ui/legacy-plugin-chart-map-box": "file:./plugins/legacy-plugin-chart-map-box",
|
||||||
"@superset-ui/legacy-plugin-chart-paired-t-test": "file:./plugins/legacy-plugin-chart-paired-t-test",
|
"@superset-ui/legacy-plugin-chart-paired-t-test": "file:./plugins/legacy-plugin-chart-paired-t-test",
|
||||||
"@superset-ui/legacy-plugin-chart-parallel-coordinates": "file:./plugins/legacy-plugin-chart-parallel-coordinates",
|
"@superset-ui/legacy-plugin-chart-parallel-coordinates": "file:./plugins/legacy-plugin-chart-parallel-coordinates",
|
||||||
"@superset-ui/legacy-plugin-chart-partition": "file:./plugins/legacy-plugin-chart-partition",
|
"@superset-ui/legacy-plugin-chart-partition": "file:./plugins/legacy-plugin-chart-partition",
|
||||||
"@superset-ui/legacy-plugin-chart-rose": "file:./plugins/legacy-plugin-chart-rose",
|
"@superset-ui/legacy-plugin-chart-rose": "file:./plugins/legacy-plugin-chart-rose",
|
||||||
"@superset-ui/legacy-plugin-chart-sankey": "file:./plugins/legacy-plugin-chart-sankey",
|
|
||||||
"@superset-ui/legacy-plugin-chart-sankey-loop": "file:./plugins/legacy-plugin-chart-sankey-loop",
|
|
||||||
"@superset-ui/legacy-plugin-chart-world-map": "file:./plugins/legacy-plugin-chart-world-map",
|
"@superset-ui/legacy-plugin-chart-world-map": "file:./plugins/legacy-plugin-chart-world-map",
|
||||||
"@superset-ui/legacy-preset-chart-deckgl": "file:./plugins/legacy-preset-chart-deckgl",
|
"@superset-ui/legacy-preset-chart-deckgl": "file:./plugins/legacy-preset-chart-deckgl",
|
||||||
"@superset-ui/legacy-preset-chart-nvd3": "file:./plugins/legacy-preset-chart-nvd3",
|
"@superset-ui/legacy-preset-chart-nvd3": "file:./plugins/legacy-preset-chart-nvd3",
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ const formData: SqlaFormData = {
|
||||||
cumulative: true,
|
cumulative: true,
|
||||||
normalize: true,
|
normalize: true,
|
||||||
groupby: ['country', 'region'],
|
groupby: ['country', 'region'],
|
||||||
viz_type: VizType.LegacyHistogram,
|
viz_type: VizType.Histogram,
|
||||||
datasource: 'foo',
|
datasource: 'foo',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,6 @@ export enum VizType {
|
||||||
Chord = 'chord',
|
Chord = 'chord',
|
||||||
Compare = 'compare',
|
Compare = 'compare',
|
||||||
CountryMap = 'country_map',
|
CountryMap = 'country_map',
|
||||||
DistBar = 'dist_bar',
|
|
||||||
EventFlow = 'event_flow',
|
|
||||||
Funnel = 'funnel',
|
Funnel = 'funnel',
|
||||||
Gauge = 'gauge_chart',
|
Gauge = 'gauge_chart',
|
||||||
Graph = 'graph_chart',
|
Graph = 'graph_chart',
|
||||||
|
|
@ -39,13 +37,7 @@ export enum VizType {
|
||||||
Heatmap = 'heatmap_v2',
|
Heatmap = 'heatmap_v2',
|
||||||
Histogram = 'histogram_v2',
|
Histogram = 'histogram_v2',
|
||||||
Horizon = 'horizon',
|
Horizon = 'horizon',
|
||||||
LegacyArea = 'area',
|
|
||||||
LegacyBar = 'bar',
|
|
||||||
LegacyBubble = 'bubble',
|
LegacyBubble = 'bubble',
|
||||||
LegacyHeatmap = 'heatmap',
|
|
||||||
LegacyHistogram = 'histogram',
|
|
||||||
LegacyLine = 'line',
|
|
||||||
LegacySankey = 'sankey',
|
|
||||||
Line = 'echarts_timeseries_line',
|
Line = 'echarts_timeseries_line',
|
||||||
MapBox = 'mapbox',
|
MapBox = 'mapbox',
|
||||||
MixedTimeseries = 'mixed_timeseries',
|
MixedTimeseries = 'mixed_timeseries',
|
||||||
|
|
|
||||||
|
|
@ -87,13 +87,13 @@ describe('ChartClient', () => {
|
||||||
sliceId,
|
sliceId,
|
||||||
formData: {
|
formData: {
|
||||||
granularity: 'second',
|
granularity: 'second',
|
||||||
viz_type: VizType.LegacyBar,
|
viz_type: VizType.Bar,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
).resolves.toEqual({
|
).resolves.toEqual({
|
||||||
...sankeyFormData,
|
...sankeyFormData,
|
||||||
granularity: 'second',
|
granularity: 'second',
|
||||||
viz_type: VizType.LegacyBar,
|
viz_type: VizType.Bar,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('returns promise of formData if only formData was given', () =>
|
it('returns promise of formData if only formData was given', () =>
|
||||||
|
|
@ -102,13 +102,13 @@ describe('ChartClient', () => {
|
||||||
formData: {
|
formData: {
|
||||||
datasource: '1__table',
|
datasource: '1__table',
|
||||||
granularity: 'minute',
|
granularity: 'minute',
|
||||||
viz_type: VizType.LegacyLine,
|
viz_type: VizType.Line,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
).resolves.toEqual({
|
).resolves.toEqual({
|
||||||
datasource: '1__table',
|
datasource: '1__table',
|
||||||
granularity: 'minute',
|
granularity: 'minute',
|
||||||
viz_type: VizType.LegacyLine,
|
viz_type: VizType.Line,
|
||||||
}));
|
}));
|
||||||
it('rejects if none of sliceId or formData is specified', () =>
|
it('rejects if none of sliceId or formData is specified', () =>
|
||||||
expect(
|
expect(
|
||||||
|
|
@ -256,7 +256,7 @@ describe('ChartClient', () => {
|
||||||
it('loadAllDataNecessaryForAChart', () => {
|
it('loadAllDataNecessaryForAChart', () => {
|
||||||
fetchMock.get(`glob:*/api/v1/form_data/?slice_id=${sliceId}`, {
|
fetchMock.get(`glob:*/api/v1/form_data/?slice_id=${sliceId}`, {
|
||||||
granularity: 'minute',
|
granularity: 'minute',
|
||||||
viz_type: VizType.LegacyLine,
|
viz_type: VizType.Line,
|
||||||
datasource: '1__table',
|
datasource: '1__table',
|
||||||
color: 'living-coral',
|
color: 'living-coral',
|
||||||
});
|
});
|
||||||
|
|
@ -276,12 +276,12 @@ describe('ChartClient', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
getChartMetadataRegistry().registerValue(
|
getChartMetadataRegistry().registerValue(
|
||||||
VizType.LegacyLine,
|
VizType.Line,
|
||||||
new ChartMetadata({ name: 'Line', thumbnail: '.gif' }),
|
new ChartMetadata({ name: 'Line', thumbnail: '.gif' }),
|
||||||
);
|
);
|
||||||
|
|
||||||
getChartBuildQueryRegistry().registerValue(
|
getChartBuildQueryRegistry().registerValue(
|
||||||
VizType.LegacyLine,
|
VizType.Line,
|
||||||
(formData: QueryFormData) => buildQueryContext(formData),
|
(formData: QueryFormData) => buildQueryContext(formData),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -297,7 +297,7 @@ describe('ChartClient', () => {
|
||||||
},
|
},
|
||||||
formData: {
|
formData: {
|
||||||
granularity: 'minute',
|
granularity: 'minute',
|
||||||
viz_type: VizType.LegacyLine,
|
viz_type: VizType.Line,
|
||||||
datasource: '1__table',
|
datasource: '1__table',
|
||||||
color: 'living-coral',
|
color: 'living-coral',
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ export const sunburstFormData = {
|
||||||
|
|
||||||
export const sankeyFormData = {
|
export const sankeyFormData = {
|
||||||
datasource: '1__table',
|
datasource: '1__table',
|
||||||
viz_type: VizType.LegacySankey,
|
viz_type: VizType.Sankey,
|
||||||
slice_id: 1,
|
slice_id: 1,
|
||||||
url_params: {},
|
url_params: {},
|
||||||
granularity_sqla: null,
|
granularity_sqla: null,
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ describe('getFormData()', () => {
|
||||||
|
|
||||||
const mockData = {
|
const mockData = {
|
||||||
datasource: '1__table',
|
datasource: '1__table',
|
||||||
viz_type: VizType.LegacySankey,
|
viz_type: VizType.Sankey,
|
||||||
slice_id: 1,
|
slice_id: 1,
|
||||||
url_params: {},
|
url_params: {},
|
||||||
granularity_sqla: null,
|
granularity_sqla: null,
|
||||||
|
|
|
||||||
|
|
@ -70,17 +70,12 @@
|
||||||
"@superset-ui/legacy-plugin-chart-calendar": "*",
|
"@superset-ui/legacy-plugin-chart-calendar": "*",
|
||||||
"@superset-ui/legacy-plugin-chart-chord": "*",
|
"@superset-ui/legacy-plugin-chart-chord": "*",
|
||||||
"@superset-ui/legacy-plugin-chart-country-map": "*",
|
"@superset-ui/legacy-plugin-chart-country-map": "*",
|
||||||
"@superset-ui/legacy-plugin-chart-event-flow": "*",
|
|
||||||
"@superset-ui/legacy-plugin-chart-heatmap": "*",
|
|
||||||
"@superset-ui/legacy-plugin-chart-histogram": "*",
|
|
||||||
"@superset-ui/legacy-plugin-chart-horizon": "*",
|
"@superset-ui/legacy-plugin-chart-horizon": "*",
|
||||||
"@superset-ui/legacy-plugin-chart-map-box": "*",
|
"@superset-ui/legacy-plugin-chart-map-box": "*",
|
||||||
"@superset-ui/legacy-plugin-chart-paired-t-test": "*",
|
"@superset-ui/legacy-plugin-chart-paired-t-test": "*",
|
||||||
"@superset-ui/legacy-plugin-chart-parallel-coordinates": "*",
|
"@superset-ui/legacy-plugin-chart-parallel-coordinates": "*",
|
||||||
"@superset-ui/legacy-plugin-chart-partition": "*",
|
"@superset-ui/legacy-plugin-chart-partition": "*",
|
||||||
"@superset-ui/legacy-plugin-chart-rose": "*",
|
"@superset-ui/legacy-plugin-chart-rose": "*",
|
||||||
"@superset-ui/legacy-plugin-chart-sankey": "*",
|
|
||||||
"@superset-ui/legacy-plugin-chart-sankey-loop": "*",
|
|
||||||
"@superset-ui/legacy-plugin-chart-time-table": "*",
|
"@superset-ui/legacy-plugin-chart-time-table": "*",
|
||||||
"@superset-ui/legacy-plugin-chart-world-map": "*",
|
"@superset-ui/legacy-plugin-chart-world-map": "*",
|
||||||
"@superset-ui/legacy-preset-chart-deckgl": "*",
|
"@superset-ui/legacy-preset-chart-deckgl": "*",
|
||||||
|
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { SuperChart } from '@superset-ui/core';
|
|
||||||
import sampleEvents from '@data-ui/event-flow/build/sampleEvents';
|
|
||||||
import EventFlowChartPlugin from '@superset-ui/legacy-plugin-chart-event-flow';
|
|
||||||
|
|
||||||
new EventFlowChartPlugin().configure({ key: 'event-flow' }).register();
|
|
||||||
|
|
||||||
export default {
|
|
||||||
title: 'Legacy Chart Plugins/legacy-plugin-chart-event-flow',
|
|
||||||
};
|
|
||||||
|
|
||||||
const data = sampleEvents.twentyUsers.allEvents.map(
|
|
||||||
({ ENTITY_ID, EVENT_NAME, TS }) => ({
|
|
||||||
__timestamp: TS,
|
|
||||||
eventName: EVENT_NAME,
|
|
||||||
userId: ENTITY_ID,
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
export const basic = () => (
|
|
||||||
<SuperChart
|
|
||||||
chartType="event-flow"
|
|
||||||
width={400}
|
|
||||||
height={400}
|
|
||||||
queriesData={[{ data }]}
|
|
||||||
formData={{
|
|
||||||
allColumnsX: 'eventName',
|
|
||||||
entity: 'userId',
|
|
||||||
minLeafNodeEventCount: 1,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
@ -1,147 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { SuperChart, VizType } from '@superset-ui/core';
|
|
||||||
import HeatmapChartPlugin from '@superset-ui/legacy-plugin-chart-heatmap';
|
|
||||||
import ResizableChartDemo from '../../../shared/components/ResizableChartDemo';
|
|
||||||
import data from './data';
|
|
||||||
|
|
||||||
new HeatmapChartPlugin().configure({ key: VizType.LegacyHeatmap }).register();
|
|
||||||
|
|
||||||
export default {
|
|
||||||
title: 'Legacy Chart Plugins/legacy-plugin-chart-heatmap',
|
|
||||||
};
|
|
||||||
|
|
||||||
export const basic = () => (
|
|
||||||
<SuperChart
|
|
||||||
chartType={VizType.LegacyHeatmap}
|
|
||||||
width={500}
|
|
||||||
height={500}
|
|
||||||
formData={{
|
|
||||||
allColumnsX: 'source',
|
|
||||||
allColumnsY: 'target',
|
|
||||||
bottomMargin: 'auto',
|
|
||||||
canvasImageRendering: 'pixelated',
|
|
||||||
leftMargin: 'auto',
|
|
||||||
linearColorScheme: 'blue_white_yellow',
|
|
||||||
metric: 'sum__value',
|
|
||||||
normalized: false,
|
|
||||||
showLegend: true,
|
|
||||||
showPerc: true,
|
|
||||||
showValues: false,
|
|
||||||
sortXAxis: 'alpha_asc',
|
|
||||||
sortYAxis: 'alpha_asc',
|
|
||||||
xscaleInterval: '1',
|
|
||||||
yAxisBounds: [null, null],
|
|
||||||
yAxisFormat: '.3s',
|
|
||||||
yscaleInterval: '1',
|
|
||||||
}}
|
|
||||||
queriesData={[
|
|
||||||
{
|
|
||||||
data: {
|
|
||||||
records: data,
|
|
||||||
extents: [0.1, 24.9],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
||||||
export const resizable = () => (
|
|
||||||
<ResizableChartDemo>
|
|
||||||
{({ width, height }) => (
|
|
||||||
<SuperChart
|
|
||||||
chartType={VizType.LegacyHeatmap}
|
|
||||||
width={width}
|
|
||||||
height={height}
|
|
||||||
formData={{
|
|
||||||
allColumnsX: 'source',
|
|
||||||
allColumnsY: 'target',
|
|
||||||
bottomMargin: 'auto',
|
|
||||||
canvasImageRendering: 'pixelated',
|
|
||||||
leftMargin: 'auto',
|
|
||||||
linearColorScheme: 'blue_white_yellow',
|
|
||||||
metric: 'sum__value',
|
|
||||||
normalized: false,
|
|
||||||
showLegend: true,
|
|
||||||
showPerc: true,
|
|
||||||
showValues: false,
|
|
||||||
sortXAxis: 'alpha_asc',
|
|
||||||
sortYAxis: 'alpha_asc',
|
|
||||||
xscaleInterval: '1',
|
|
||||||
yAxisBounds: [null, null],
|
|
||||||
yAxisFormat: '.3s',
|
|
||||||
yscaleInterval: '1',
|
|
||||||
}}
|
|
||||||
queriesData={[
|
|
||||||
{
|
|
||||||
data: {
|
|
||||||
records: data,
|
|
||||||
extents: [0.1, 24.9],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</ResizableChartDemo>
|
|
||||||
);
|
|
||||||
|
|
||||||
export const withNullData = () => (
|
|
||||||
<SuperChart
|
|
||||||
chartType={VizType.LegacyHeatmap}
|
|
||||||
width={500}
|
|
||||||
height={500}
|
|
||||||
formData={{
|
|
||||||
allColumnsX: 'source',
|
|
||||||
allColumnsY: 'target',
|
|
||||||
bottomMargin: 'auto',
|
|
||||||
canvasImageRendering: 'pixelated',
|
|
||||||
leftMargin: 'auto',
|
|
||||||
linearColorScheme: 'blue_white_yellow',
|
|
||||||
metric: 'sum__value',
|
|
||||||
normalized: false,
|
|
||||||
showLegend: true,
|
|
||||||
showPerc: true,
|
|
||||||
showValues: false,
|
|
||||||
sortXAxis: 'alpha_asc',
|
|
||||||
sortYAxis: 'alpha_asc',
|
|
||||||
xscaleInterval: '1',
|
|
||||||
yAxisBounds: [null, null],
|
|
||||||
yAxisFormat: '.3s',
|
|
||||||
yscaleInterval: '1',
|
|
||||||
}}
|
|
||||||
queriesData={[
|
|
||||||
{
|
|
||||||
data: {
|
|
||||||
records: [
|
|
||||||
...data,
|
|
||||||
{
|
|
||||||
x: null,
|
|
||||||
y: 'Electricity and heat',
|
|
||||||
v: 25.9,
|
|
||||||
perc: 0.43,
|
|
||||||
rank: 1.0,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
extents: [0.1, 24.9],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
@ -1,182 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
export default [
|
|
||||||
{
|
|
||||||
x: 'Energy',
|
|
||||||
y: 'Electricity and heat',
|
|
||||||
v: 24.9,
|
|
||||||
perc: 1.0,
|
|
||||||
rank: 1.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'Energy',
|
|
||||||
y: 'Industry',
|
|
||||||
v: 14.7,
|
|
||||||
perc: 0.5887096774193549,
|
|
||||||
rank: 0.9882352941176471,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'Energy',
|
|
||||||
y: 'Transportation',
|
|
||||||
v: 14.3,
|
|
||||||
perc: 0.5725806451612905,
|
|
||||||
rank: 0.9764705882352941,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'Deforestation',
|
|
||||||
y: 'Carbon Dioxide',
|
|
||||||
v: 10.9,
|
|
||||||
perc: 0.435483870967742,
|
|
||||||
rank: 0.9588235294117647,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'Land Use Change',
|
|
||||||
y: 'Deforestation',
|
|
||||||
v: 10.9,
|
|
||||||
perc: 0.435483870967742,
|
|
||||||
rank: 0.9588235294117647,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'Road',
|
|
||||||
y: 'Carbon Dioxide',
|
|
||||||
v: 10.5,
|
|
||||||
perc: 0.4193548387096775,
|
|
||||||
rank: 0.9352941176470588,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'Transportation',
|
|
||||||
y: 'Road',
|
|
||||||
v: 10.5,
|
|
||||||
perc: 0.4193548387096775,
|
|
||||||
rank: 0.9352941176470588,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'Residential Buildings',
|
|
||||||
y: 'Carbon Dioxide',
|
|
||||||
v: 10.2,
|
|
||||||
perc: 0.40725806451612906,
|
|
||||||
rank: 0.9176470588235294,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'Energy',
|
|
||||||
y: 'Other Fuel Combustion',
|
|
||||||
v: 8.6,
|
|
||||||
perc: 0.342741935483871,
|
|
||||||
rank: 0.9058823529411765,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'Other Industry',
|
|
||||||
y: 'Carbon Dioxide',
|
|
||||||
v: 6.6,
|
|
||||||
perc: 0.26209677419354843,
|
|
||||||
rank: 0.8941176470588236,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'Commercial Buildings',
|
|
||||||
y: 'Carbon Dioxide',
|
|
||||||
v: 6.3,
|
|
||||||
perc: 0.25000000000000006,
|
|
||||||
rank: 0.8823529411764706,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'Agriculture',
|
|
||||||
y: 'Livestock and Manure',
|
|
||||||
v: 5.4,
|
|
||||||
perc: 0.2137096774193549,
|
|
||||||
rank: 0.8705882352941177,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'Agriculture',
|
|
||||||
y: 'Agriculture Soils',
|
|
||||||
v: 5.2,
|
|
||||||
perc: 0.20564516129032262,
|
|
||||||
rank: 0.8470588235294118,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'Agriculture Soils',
|
|
||||||
y: 'Nitrous Oxide',
|
|
||||||
v: 5.2,
|
|
||||||
perc: 0.20564516129032262,
|
|
||||||
rank: 0.8470588235294118,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'Oil and Gas Processing',
|
|
||||||
y: 'Methane',
|
|
||||||
v: 2.8,
|
|
||||||
perc: 0.10887096774193548,
|
|
||||||
rank: 0.6705882352941176,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'Electricity and heat',
|
|
||||||
y: 'Other Industry',
|
|
||||||
v: 2.7,
|
|
||||||
perc: 0.10483870967741937,
|
|
||||||
rank: 0.6470588235294118,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'Rail - Ship and Other Transport',
|
|
||||||
y: 'Carbon Dioxide',
|
|
||||||
v: 2.5,
|
|
||||||
perc: 0.09677419354838711,
|
|
||||||
rank: 0.6294117647058823,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'Transportation',
|
|
||||||
y: 'Rail - Ship and Other Transport',
|
|
||||||
v: 2.5,
|
|
||||||
perc: 0.09677419354838711,
|
|
||||||
rank: 0.6294117647058823,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'Electricity and heat',
|
|
||||||
y: 'T and D Losses',
|
|
||||||
v: 2.2,
|
|
||||||
perc: 0.08467741935483872,
|
|
||||||
rank: 0.6058823529411764,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'T and D Losses',
|
|
||||||
y: 'Carbon Dioxide',
|
|
||||||
v: 2.2,
|
|
||||||
perc: 0.08467741935483872,
|
|
||||||
rank: 0.6058823529411764,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'Electricity and heat',
|
|
||||||
y: 'Unallocated Fuel Combustion',
|
|
||||||
v: 2.0,
|
|
||||||
perc: 0.07661290322580645,
|
|
||||||
rank: 0.5882352941176471,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'Industry',
|
|
||||||
y: 'Cement',
|
|
||||||
v: 1.9,
|
|
||||||
perc: 0.07258064516129033,
|
|
||||||
rank: 0.5764705882352941,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'Other Fuel Combustion',
|
|
||||||
y: 'Unallocated Fuel Combustion',
|
|
||||||
v: 1.8,
|
|
||||||
perc: 0.0685483870967742,
|
|
||||||
rank: 0.5647058823529412,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* eslint-disable no-magic-numbers */
|
|
||||||
import { SuperChart, VizType } from '@superset-ui/core';
|
|
||||||
import HistogramChartPlugin from '@superset-ui/legacy-plugin-chart-histogram';
|
|
||||||
import data from './data';
|
|
||||||
|
|
||||||
new HistogramChartPlugin()
|
|
||||||
.configure({ key: VizType.LegacyHistogram })
|
|
||||||
.register();
|
|
||||||
|
|
||||||
export default {
|
|
||||||
title: 'Legacy Chart Plugins/legacy-plugin-chart-histogram',
|
|
||||||
};
|
|
||||||
|
|
||||||
export const basic = () => (
|
|
||||||
<SuperChart
|
|
||||||
chartType={VizType.LegacyHistogram}
|
|
||||||
width={400}
|
|
||||||
height={400}
|
|
||||||
queriesData={[{ data }]}
|
|
||||||
formData={{
|
|
||||||
colorScheme: 'd3Category10',
|
|
||||||
globalOpacity: 1,
|
|
||||||
linkLength: 15, // binCount
|
|
||||||
normalized: false,
|
|
||||||
xAxisLabel: 'Score',
|
|
||||||
yAxisLabel: 'Count',
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* eslint-disable sort-keys, no-magic-numbers */
|
|
||||||
export default [
|
|
||||||
{
|
|
||||||
key: 'Entrance exam',
|
|
||||||
values: [
|
|
||||||
0.87, 0.944, 1.0, 0.879, 0.69, 0.667, 0.794, 0.838, 0.875, 0.385, 0.968,
|
|
||||||
0.804, 1.0, 0.943, 0.96, 0.333, 0.5, 0.929, 0.863, 0.75, 0.957, 0.914,
|
|
||||||
1.0, 0.909, 0.742, 0.964, 0.25, 0.75, 0.5, 0.867, 0.909, 0.333, 0.867,
|
|
||||||
0.952, 0.857, 0.949, 0.857, 0.333, 0.8, 0.707, 0.833, 0.75, 0.88, 0.771,
|
|
||||||
1.0, 1.0, 0.769, 1.0, 0.769, 0.622, 0.909, 0.725, 0.951, 1.0,
|
|
||||||
],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* eslint-disable no-magic-numbers */
|
|
||||||
import { SuperChart } from '@superset-ui/core';
|
|
||||||
import SankeyLoopChartPlugin from '@superset-ui/legacy-plugin-chart-sankey-loop';
|
|
||||||
import data from './data';
|
|
||||||
|
|
||||||
new SankeyLoopChartPlugin().configure({ key: 'sankey-loop' }).register();
|
|
||||||
|
|
||||||
export default {
|
|
||||||
title: 'Legacy Chart Plugins/legacy-plugin-chart-sankey-loop',
|
|
||||||
};
|
|
||||||
|
|
||||||
export const basic = () => (
|
|
||||||
<SuperChart
|
|
||||||
chartType="sankey-loop"
|
|
||||||
width={400}
|
|
||||||
height={400}
|
|
||||||
queriesData={[{ data }]}
|
|
||||||
formData={{
|
|
||||||
colorScheme: 'd3Category10',
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* eslint-disable sort-keys, no-magic-numbers */
|
|
||||||
export default [
|
|
||||||
{
|
|
||||||
source: 'Lisdoonvarna',
|
|
||||||
target: 'Cliffs of Moher',
|
|
||||||
value: 50,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
source: 'Cliffs of Moher',
|
|
||||||
target: 'Lisdoonvarna',
|
|
||||||
value: 35,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
source: 'Cliffs of Moher',
|
|
||||||
target: 'Killarney',
|
|
||||||
value: 25,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
source: 'Lisdoonvarna',
|
|
||||||
target: 'Killarney',
|
|
||||||
value: 25,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
source: 'Lisdoonvarna',
|
|
||||||
target: 'Kinvarra',
|
|
||||||
value: 25,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
source: 'Kinvarra',
|
|
||||||
target: 'Lisdoonvarna',
|
|
||||||
value: 25,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* eslint-disable no-magic-numbers */
|
|
||||||
import { SuperChart, VizType } from '@superset-ui/core';
|
|
||||||
import SankeyChartPlugin from '@superset-ui/legacy-plugin-chart-sankey';
|
|
||||||
import ResizableChartDemo from '../../../shared/components/ResizableChartDemo';
|
|
||||||
import data from './data';
|
|
||||||
|
|
||||||
new SankeyChartPlugin().configure({ key: VizType.LegacySankey }).register();
|
|
||||||
|
|
||||||
export default {
|
|
||||||
title: 'Legacy Chart Plugins/legacy-plugin-chart-sankey',
|
|
||||||
};
|
|
||||||
|
|
||||||
export const basic = () => (
|
|
||||||
<SuperChart
|
|
||||||
chartType={VizType.LegacySankey}
|
|
||||||
width={400}
|
|
||||||
height={400}
|
|
||||||
queriesData={[{ data }]}
|
|
||||||
formData={{
|
|
||||||
colorScheme: 'd3Category10',
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
||||||
export const resizable = () => (
|
|
||||||
<ResizableChartDemo>
|
|
||||||
{({ width, height }) => (
|
|
||||||
<SuperChart
|
|
||||||
chartType={VizType.LegacySankey}
|
|
||||||
width={width}
|
|
||||||
height={height}
|
|
||||||
queriesData={[{ data }]}
|
|
||||||
formData={{
|
|
||||||
colorScheme: 'd3Category10',
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</ResizableChartDemo>
|
|
||||||
);
|
|
||||||
|
|
@ -1,72 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* eslint-disable sort-keys, no-magic-numbers */
|
|
||||||
export default [
|
|
||||||
{
|
|
||||||
source: 'Energy',
|
|
||||||
target: 'Electricity and heat',
|
|
||||||
value: 24.9,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
source: 'Energy',
|
|
||||||
target: 'Industry',
|
|
||||||
value: 14.7,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
source: 'Energy',
|
|
||||||
target: 'Transportation',
|
|
||||||
value: 14.3,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
source: 'Deforestation',
|
|
||||||
target: 'Carbon Dioxide',
|
|
||||||
value: 10.9,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
source: 'Land Use Change',
|
|
||||||
target: 'Deforestation',
|
|
||||||
value: 10.9,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
source: 'Road',
|
|
||||||
target: 'Carbon Dioxide',
|
|
||||||
value: 10.5,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
source: 'Transportation',
|
|
||||||
target: 'Road',
|
|
||||||
value: 10.5,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
source: 'Residential Buildings',
|
|
||||||
target: 'Carbon Dioxide',
|
|
||||||
value: 10.2,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
source: 'Energy',
|
|
||||||
target: 'Other Fuel Combustion',
|
|
||||||
value: 8.6,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
source: 'Other Industry',
|
|
||||||
target: 'Carbon Dioxide',
|
|
||||||
value: 6.6,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { VizType } from '@superset-ui/core';
|
|
||||||
import { AreaChartPlugin } from '@superset-ui/legacy-preset-chart-nvd3';
|
|
||||||
|
|
||||||
new AreaChartPlugin().configure({ key: VizType.LegacyArea }).register();
|
|
||||||
|
|
||||||
export default {
|
|
||||||
title: 'Legacy Chart Plugins/legacy-preset-chart-nvd3/Area',
|
|
||||||
};
|
|
||||||
|
|
||||||
export { stacked } from './stories/stacked';
|
|
||||||
export {
|
|
||||||
stackedWithYAxisBounds,
|
|
||||||
stackedWithYAxisBoundsMinOnly,
|
|
||||||
} from './stories/stackedWithBounds';
|
|
||||||
export { expanded } from './stories/expanded';
|
|
||||||
export { controlsShown } from './stories/controlsShown';
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { SuperChart, VizType } from '@superset-ui/core';
|
|
||||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
|
||||||
import data from '../data';
|
|
||||||
|
|
||||||
export const controlsShown = () => (
|
|
||||||
<SuperChart
|
|
||||||
chartType={VizType.LegacyArea}
|
|
||||||
datasource={dummyDatasource}
|
|
||||||
width={400}
|
|
||||||
height={400}
|
|
||||||
queriesData={[{ data }]}
|
|
||||||
formData={{
|
|
||||||
bottomMargin: 'auto',
|
|
||||||
colorScheme: 'd3Category10',
|
|
||||||
contribution: false,
|
|
||||||
groupby: ['region'],
|
|
||||||
lineInterpolation: 'linear',
|
|
||||||
metrics: ['sum__SP_POP_TOTL'],
|
|
||||||
richTooltip: true,
|
|
||||||
showBrush: 'auto',
|
|
||||||
showControls: true,
|
|
||||||
showLegend: true,
|
|
||||||
stackedStyle: 'stack',
|
|
||||||
vizType: VizType.LegacyArea,
|
|
||||||
xAxisFormat: '%Y',
|
|
||||||
xAxisLabel: '',
|
|
||||||
xAxisShowminmax: false,
|
|
||||||
xTicksLayout: 'auto',
|
|
||||||
yAxisBounds: [null, null],
|
|
||||||
yAxisFormat: '.3s',
|
|
||||||
yLogScale: false,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { SuperChart, VizType } from '@superset-ui/core';
|
|
||||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
|
||||||
import data from '../data';
|
|
||||||
|
|
||||||
export const expanded = () => (
|
|
||||||
<SuperChart
|
|
||||||
chartType={VizType.LegacyArea}
|
|
||||||
datasource={dummyDatasource}
|
|
||||||
width={400}
|
|
||||||
height={400}
|
|
||||||
queriesData={[{ data }]}
|
|
||||||
formData={{
|
|
||||||
bottomMargin: 'auto',
|
|
||||||
colorScheme: 'd3Category10',
|
|
||||||
contribution: false,
|
|
||||||
groupby: ['region'],
|
|
||||||
lineInterpolation: 'linear',
|
|
||||||
metrics: ['sum__SP_POP_TOTL'],
|
|
||||||
richTooltip: true,
|
|
||||||
showBrush: 'auto',
|
|
||||||
showControls: false,
|
|
||||||
showLegend: true,
|
|
||||||
stackedStyle: 'expand',
|
|
||||||
vizType: VizType.LegacyArea,
|
|
||||||
xAxisFormat: '%Y',
|
|
||||||
xAxisLabel: '',
|
|
||||||
xAxisShowminmax: false,
|
|
||||||
xTicksLayout: 'auto',
|
|
||||||
yAxisBounds: [null, null],
|
|
||||||
yAxisFormat: '.3s',
|
|
||||||
yLogScale: false,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
@ -1,54 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { SuperChart, VizType } from '@superset-ui/core';
|
|
||||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
|
||||||
import data from '../data';
|
|
||||||
|
|
||||||
export const stacked = () => (
|
|
||||||
<SuperChart
|
|
||||||
id="stacked-area-chart"
|
|
||||||
chartType={VizType.LegacyArea}
|
|
||||||
datasource={dummyDatasource}
|
|
||||||
width={400}
|
|
||||||
height={400}
|
|
||||||
queriesData={[{ data }]}
|
|
||||||
formData={{
|
|
||||||
bottomMargin: 'auto',
|
|
||||||
colorScheme: 'd3Category10',
|
|
||||||
contribution: false,
|
|
||||||
groupby: ['region'],
|
|
||||||
lineInterpolation: 'linear',
|
|
||||||
metrics: ['sum__SP_POP_TOTL'],
|
|
||||||
richTooltip: true,
|
|
||||||
showBrush: 'auto',
|
|
||||||
showControls: false,
|
|
||||||
showLegend: true,
|
|
||||||
stackedStyle: 'stack',
|
|
||||||
vizType: VizType.LegacyArea,
|
|
||||||
xAxisFormat: '%Y',
|
|
||||||
xAxisLabel: '',
|
|
||||||
xAxisShowminmax: false,
|
|
||||||
xTicksLayout: 'auto',
|
|
||||||
yAxisBounds: [null, null],
|
|
||||||
yAxisFormat: '.3s',
|
|
||||||
yLogScale: false,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
@ -1,88 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { SuperChart, VizType } from '@superset-ui/core';
|
|
||||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
|
||||||
import data from '../data';
|
|
||||||
|
|
||||||
export const stackedWithYAxisBounds = () => (
|
|
||||||
<SuperChart
|
|
||||||
chartType={VizType.LegacyArea}
|
|
||||||
datasource={dummyDatasource}
|
|
||||||
width={400}
|
|
||||||
height={400}
|
|
||||||
queriesData={[{ data }]}
|
|
||||||
formData={{
|
|
||||||
bottomMargin: 'auto',
|
|
||||||
colorScheme: 'd3Category10',
|
|
||||||
contribution: false,
|
|
||||||
groupby: ['region'],
|
|
||||||
lineInterpolation: 'linear',
|
|
||||||
metrics: ['sum__SP_POP_TOTL'],
|
|
||||||
richTooltip: true,
|
|
||||||
showBrush: 'auto',
|
|
||||||
showControls: false,
|
|
||||||
showLegend: true,
|
|
||||||
stackedStyle: 'stack',
|
|
||||||
vizType: VizType.LegacyArea,
|
|
||||||
xAxisFormat: '%Y',
|
|
||||||
xAxisLabel: '',
|
|
||||||
xAxisShowminmax: false,
|
|
||||||
xTicksLayout: 'auto',
|
|
||||||
yAxisBounds: [0, 3000000000],
|
|
||||||
yAxisFormat: '.3s',
|
|
||||||
yLogScale: false,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
||||||
stackedWithYAxisBounds.storyName = 'Stacked with yAxisBounds';
|
|
||||||
|
|
||||||
export const stackedWithYAxisBoundsMinOnly = () => (
|
|
||||||
<SuperChart
|
|
||||||
chartType={VizType.LegacyArea}
|
|
||||||
datasource={dummyDatasource}
|
|
||||||
width={400}
|
|
||||||
height={400}
|
|
||||||
queriesData={[{ data }]}
|
|
||||||
formData={{
|
|
||||||
bottomMargin: 'auto',
|
|
||||||
colorScheme: 'd3Category10',
|
|
||||||
contribution: false,
|
|
||||||
groupby: ['region'],
|
|
||||||
lineInterpolation: 'linear',
|
|
||||||
metrics: ['sum__SP_POP_TOTL'],
|
|
||||||
richTooltip: true,
|
|
||||||
showBrush: 'auto',
|
|
||||||
showControls: true,
|
|
||||||
showLegend: true,
|
|
||||||
stackedStyle: 'stack',
|
|
||||||
vizType: VizType.LegacyArea,
|
|
||||||
xAxisFormat: '%Y',
|
|
||||||
xAxisLabel: '',
|
|
||||||
xAxisShowminmax: false,
|
|
||||||
xTicksLayout: 'auto',
|
|
||||||
yAxisBounds: [1000000000, null],
|
|
||||||
yAxisFormat: '.3s',
|
|
||||||
yLogScale: false,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
||||||
stackedWithYAxisBoundsMinOnly.storyName = 'Stacked with yAxisBounds min only';
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { VizType } from '@superset-ui/core';
|
|
||||||
import { BarChartPlugin } from '@superset-ui/legacy-preset-chart-nvd3';
|
|
||||||
|
|
||||||
new BarChartPlugin().configure({ key: VizType.LegacyBar }).register();
|
|
||||||
|
|
||||||
export default {
|
|
||||||
title: 'Legacy Chart Plugins/legacy-preset-chart-nvd3/Bar',
|
|
||||||
};
|
|
||||||
|
|
||||||
export { basic } from './stories/basic';
|
|
||||||
export { barWithValues } from './stories/barWithValues';
|
|
||||||
export { barWithPositiveAndNegativeValues } from './stories/barWithPositiveAndNegativeValues';
|
|
||||||
export { stackedBarWithValues } from './stories/stackedBarWithValues';
|
|
||||||
|
|
@ -1,247 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* eslint-disable sort-keys */
|
|
||||||
export default [
|
|
||||||
{
|
|
||||||
key: ['East Asia & Pacific'],
|
|
||||||
values: [
|
|
||||||
{
|
|
||||||
x: -315619200000.0,
|
|
||||||
y: 1031863394.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -283996800000.0,
|
|
||||||
y: 1034767718.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -252460800000.0,
|
|
||||||
y: 1048537618.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -220924800000.0,
|
|
||||||
y: 1073600747.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -189388800000.0,
|
|
||||||
y: 1098305025.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -157766400000.0,
|
|
||||||
y: 1124077872.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -126230400000.0,
|
|
||||||
y: 1153296196.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -94694400000.0,
|
|
||||||
y: 1181582226.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -63158400000.0,
|
|
||||||
y: 1210302481.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -31536000000.0,
|
|
||||||
y: 1242569208.0,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: ['South Asia'],
|
|
||||||
values: [
|
|
||||||
{
|
|
||||||
x: -315619200000.0,
|
|
||||||
y: 572036107.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -283996800000.0,
|
|
||||||
y: 584143236.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -252460800000.0,
|
|
||||||
y: 596701125.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -220924800000.0,
|
|
||||||
y: 609571502.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -189388800000.0,
|
|
||||||
y: 623073110.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -157766400000.0,
|
|
||||||
y: 636963781.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -126230400000.0,
|
|
||||||
y: 651325994.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -94694400000.0,
|
|
||||||
y: 666134328.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -63158400000.0,
|
|
||||||
y: 681405837.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -31536000000.0,
|
|
||||||
y: 697060567.0,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: ['Europe & Central Asia'],
|
|
||||||
values: [
|
|
||||||
{
|
|
||||||
x: -315619200000.0,
|
|
||||||
y: 660881033.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -283996800000.0,
|
|
||||||
y: 668526708.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -252460800000.0,
|
|
||||||
y: 676418331.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -220924800000.0,
|
|
||||||
y: 684369825.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -189388800000.0,
|
|
||||||
y: 692233988.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -157766400000.0,
|
|
||||||
y: 699849949.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -126230400000.0,
|
|
||||||
y: 706459925.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -94694400000.0,
|
|
||||||
y: 712871897.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -63158400000.0,
|
|
||||||
y: 719034272.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -31536000000.0,
|
|
||||||
y: 725099571.0,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: ['Sub-Saharan Africa'],
|
|
||||||
values: [
|
|
||||||
{
|
|
||||||
x: -315619200000.0,
|
|
||||||
y: 228268752.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -283996800000.0,
|
|
||||||
y: 233759990.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -252460800000.0,
|
|
||||||
y: 239403621.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -220924800000.0,
|
|
||||||
y: 245217050.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -189388800000.0,
|
|
||||||
y: 251215851.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -157766400000.0,
|
|
||||||
y: 257414930.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -126230400000.0,
|
|
||||||
y: 263830697.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -94694400000.0,
|
|
||||||
y: 270477558.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -63158400000.0,
|
|
||||||
y: 277365472.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -31536000000.0,
|
|
||||||
y: 284502453.0,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: ['Latin America & Caribbean'],
|
|
||||||
values: [
|
|
||||||
{
|
|
||||||
x: -315619200000.0,
|
|
||||||
y: 220564224.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -283996800000.0,
|
|
||||||
y: 226764342.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -252460800000.0,
|
|
||||||
y: 233183206.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -220924800000.0,
|
|
||||||
y: 239771182.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -189388800000.0,
|
|
||||||
y: 246458356.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -157766400000.0,
|
|
||||||
y: 253195267.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -126230400000.0,
|
|
||||||
y: 259965218.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -94694400000.0,
|
|
||||||
y: 266776414.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -63158400000.0,
|
|
||||||
y: 273654630.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -31536000000.0,
|
|
||||||
y: 280641049.0,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
@ -1,64 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { SuperChart, VizType } from '@superset-ui/core';
|
|
||||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
|
||||||
import data from '../data';
|
|
||||||
|
|
||||||
export const barWithPositiveAndNegativeValues = () => (
|
|
||||||
<SuperChart
|
|
||||||
chartType={VizType.LegacyBar}
|
|
||||||
width={400}
|
|
||||||
height={400}
|
|
||||||
datasource={dummyDatasource}
|
|
||||||
queriesData={[
|
|
||||||
{
|
|
||||||
data: data.map((group, i) => ({
|
|
||||||
...group,
|
|
||||||
values: group.values.map(pair => ({
|
|
||||||
...pair,
|
|
||||||
y: (i % 2 === 0 ? 1 : -1) * pair.y,
|
|
||||||
})),
|
|
||||||
})),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
formData={{
|
|
||||||
bottomMargin: 'auto',
|
|
||||||
colorScheme: 'd3Category10',
|
|
||||||
contribution: false,
|
|
||||||
groupby: ['region'],
|
|
||||||
lineInterpolation: 'linear',
|
|
||||||
metrics: ['sum__SP_POP_TOTL'],
|
|
||||||
richTooltip: true,
|
|
||||||
showBarValue: true,
|
|
||||||
showBrush: 'auto',
|
|
||||||
showControls: false,
|
|
||||||
showLegend: true,
|
|
||||||
stackedStyle: 'stack',
|
|
||||||
vizType: VizType.LegacyBar,
|
|
||||||
xAxisFormat: '%Y',
|
|
||||||
xAxisLabel: '',
|
|
||||||
xAxisShowminmax: false,
|
|
||||||
xTicksLayout: 'auto',
|
|
||||||
yAxisBounds: [null, null],
|
|
||||||
yAxisFormat: '.3s',
|
|
||||||
yLogScale: false,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
@ -1,54 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { SuperChart, VizType } from '@superset-ui/core';
|
|
||||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
|
||||||
import data from '../data';
|
|
||||||
|
|
||||||
export const barWithValues = () => (
|
|
||||||
<SuperChart
|
|
||||||
chartType={VizType.LegacyBar}
|
|
||||||
width={400}
|
|
||||||
height={400}
|
|
||||||
datasource={dummyDatasource}
|
|
||||||
queriesData={[{ data }]}
|
|
||||||
formData={{
|
|
||||||
bottomMargin: 'auto',
|
|
||||||
colorScheme: 'd3Category10',
|
|
||||||
contribution: false,
|
|
||||||
groupby: ['region'],
|
|
||||||
lineInterpolation: 'linear',
|
|
||||||
metrics: ['sum__SP_POP_TOTL'],
|
|
||||||
richTooltip: true,
|
|
||||||
showBarValue: false,
|
|
||||||
showBrush: 'auto',
|
|
||||||
showControls: false,
|
|
||||||
showLegend: true,
|
|
||||||
stackedStyle: 'stack',
|
|
||||||
vizType: VizType.LegacyBar,
|
|
||||||
xAxisFormat: '%Y',
|
|
||||||
xAxisLabel: '',
|
|
||||||
xAxisShowminmax: false,
|
|
||||||
xTicksLayout: 'auto',
|
|
||||||
yAxisBounds: [null, null],
|
|
||||||
yAxisFormat: '.3s',
|
|
||||||
yLogScale: false,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
@ -1,54 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { SuperChart, VizType } from '@superset-ui/core';
|
|
||||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
|
||||||
import data from '../data';
|
|
||||||
|
|
||||||
export const basic = () => (
|
|
||||||
<SuperChart
|
|
||||||
chartType={VizType.LegacyBar}
|
|
||||||
width={400}
|
|
||||||
height={400}
|
|
||||||
datasource={dummyDatasource}
|
|
||||||
queriesData={[{ data }]}
|
|
||||||
formData={{
|
|
||||||
bottomMargin: 'auto',
|
|
||||||
colorScheme: 'd3Category10',
|
|
||||||
contribution: false,
|
|
||||||
groupby: ['region'],
|
|
||||||
lineInterpolation: 'linear',
|
|
||||||
metrics: ['sum__SP_POP_TOTL'],
|
|
||||||
richTooltip: true,
|
|
||||||
showBarValue: false,
|
|
||||||
showBrush: 'auto',
|
|
||||||
showControls: false,
|
|
||||||
showLegend: true,
|
|
||||||
stackedStyle: 'stack',
|
|
||||||
vizType: VizType.LegacyBar,
|
|
||||||
xAxisFormat: '%Y',
|
|
||||||
xAxisLabel: '',
|
|
||||||
xAxisShowminmax: false,
|
|
||||||
xTicksLayout: 'auto',
|
|
||||||
yAxisBounds: [null, null],
|
|
||||||
yAxisFormat: '.3s',
|
|
||||||
yLogScale: false,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
@ -1,55 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { SuperChart, VizType } from '@superset-ui/core';
|
|
||||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
|
||||||
import data from '../data';
|
|
||||||
|
|
||||||
export const stackedBarWithValues = () => (
|
|
||||||
<SuperChart
|
|
||||||
chartType={VizType.LegacyBar}
|
|
||||||
width={400}
|
|
||||||
height={400}
|
|
||||||
datasource={dummyDatasource}
|
|
||||||
queriesData={[{ data }]}
|
|
||||||
formData={{
|
|
||||||
barStacked: true,
|
|
||||||
bottomMargin: 'auto',
|
|
||||||
colorScheme: 'd3Category10',
|
|
||||||
contribution: false,
|
|
||||||
groupby: ['region'],
|
|
||||||
lineInterpolation: 'linear',
|
|
||||||
metrics: ['sum__SP_POP_TOTL'],
|
|
||||||
richTooltip: true,
|
|
||||||
showBarValue: true,
|
|
||||||
showBrush: 'auto',
|
|
||||||
showControls: false,
|
|
||||||
showLegend: true,
|
|
||||||
stackedStyle: 'stack',
|
|
||||||
vizType: VizType.LegacyBar,
|
|
||||||
xAxisFormat: '%Y',
|
|
||||||
xAxisLabel: '',
|
|
||||||
xAxisShowminmax: false,
|
|
||||||
xTicksLayout: 'auto',
|
|
||||||
yAxisBounds: [null, null],
|
|
||||||
yAxisFormat: '.3s',
|
|
||||||
yLogScale: false,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { DistBarChartPlugin } from '@superset-ui/legacy-preset-chart-nvd3';
|
|
||||||
|
|
||||||
new DistBarChartPlugin().configure({ key: 'dist-bar' }).register();
|
|
||||||
|
|
||||||
export default {
|
|
||||||
title: 'Legacy Chart Plugins/legacy-preset-chart-nvd3/DistBar',
|
|
||||||
};
|
|
||||||
|
|
||||||
export { basic } from './stories/basic';
|
|
||||||
export { manyBars } from './stories/manyBars';
|
|
||||||
|
|
@ -1,112 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* eslint-disable sort-keys, no-magic-numbers */
|
|
||||||
export default [
|
|
||||||
{
|
|
||||||
key: 'sum__sum_boys',
|
|
||||||
values: [
|
|
||||||
{
|
|
||||||
x: 'CA',
|
|
||||||
y: 5430796,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'TX',
|
|
||||||
y: 3311985,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'NY',
|
|
||||||
y: 3543961,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'OH',
|
|
||||||
y: 2376385,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'PA',
|
|
||||||
y: 2390275,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'IL',
|
|
||||||
y: 2357411,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'MI',
|
|
||||||
y: 1938321,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'FL',
|
|
||||||
y: 1968060,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'NJ',
|
|
||||||
y: 1486126,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'MA',
|
|
||||||
y: 1285126,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'sum__sum_girls',
|
|
||||||
values: [
|
|
||||||
{
|
|
||||||
x: 'CA',
|
|
||||||
y: 3567754,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'TX',
|
|
||||||
y: 2313186,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'NY',
|
|
||||||
y: 2280733,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'OH',
|
|
||||||
y: 1622814,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'PA',
|
|
||||||
y: 1615383,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'IL',
|
|
||||||
y: 1614427,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'MI',
|
|
||||||
y: 1326229,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'FL',
|
|
||||||
y: 1312593,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'NJ',
|
|
||||||
y: 992702,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'MA',
|
|
||||||
y: 842146,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { SuperChart, VizType } from '@superset-ui/core';
|
|
||||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
|
||||||
import data from '../data';
|
|
||||||
|
|
||||||
export const basic = () => (
|
|
||||||
<SuperChart
|
|
||||||
chartType="dist-bar"
|
|
||||||
width={400}
|
|
||||||
height={400}
|
|
||||||
datasource={dummyDatasource}
|
|
||||||
queriesData={[{ data }]}
|
|
||||||
formData={{
|
|
||||||
barstacked: false,
|
|
||||||
bottomMargin: 'auto',
|
|
||||||
colorScheme: 'd3Category10',
|
|
||||||
contribution: false,
|
|
||||||
orderBars: false,
|
|
||||||
reduceXTicks: false,
|
|
||||||
showBarValue: false,
|
|
||||||
showControls: false,
|
|
||||||
showLegend: true,
|
|
||||||
vizType: VizType.DistBar,
|
|
||||||
xAxisLabel: 'ddd',
|
|
||||||
xTicksLayout: 'auto',
|
|
||||||
yAxisFormat: '.3s',
|
|
||||||
yAxisLabel: 'ddd',
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { SuperChart, VizType, seedRandom } from '@superset-ui/core';
|
|
||||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
|
||||||
|
|
||||||
const data: {
|
|
||||||
key: string;
|
|
||||||
values: {
|
|
||||||
x: string;
|
|
||||||
y: number;
|
|
||||||
}[];
|
|
||||||
}[] = [{ key: 'sth', values: [] }];
|
|
||||||
const LONG_LABEL =
|
|
||||||
'some extremely ridiculously extremely extremely extremely ridiculously extremely extremely ridiculously extremely extremely ridiculously extremely long category';
|
|
||||||
|
|
||||||
for (let i = 0; i < 50; i += 1) {
|
|
||||||
data[0].values.push({
|
|
||||||
x: `${LONG_LABEL.substring(
|
|
||||||
0,
|
|
||||||
Math.round(seedRandom() * LONG_LABEL.length),
|
|
||||||
)} ${i + 1}`,
|
|
||||||
y: Math.round(seedRandom() * 10000),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export const manyBars = () => (
|
|
||||||
<SuperChart
|
|
||||||
chartType="dist-bar"
|
|
||||||
width={400}
|
|
||||||
height={400}
|
|
||||||
datasource={dummyDatasource}
|
|
||||||
queriesData={[{ data }]}
|
|
||||||
formData={{
|
|
||||||
colorScheme: 'd3Category10',
|
|
||||||
showBarValue: false,
|
|
||||||
showLegend: true,
|
|
||||||
vizType: VizType.DistBar,
|
|
||||||
xTicksLayout: 'auto',
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { VizType } from '@superset-ui/core';
|
|
||||||
import { LineChartPlugin } from '@superset-ui/legacy-preset-chart-nvd3';
|
|
||||||
|
|
||||||
new LineChartPlugin().configure({ key: VizType.LegacyLine }).register();
|
|
||||||
|
|
||||||
export default {
|
|
||||||
title: 'Legacy Chart Plugins/legacy-preset-chart-nvd3/Line',
|
|
||||||
};
|
|
||||||
|
|
||||||
export { basic } from './stories/basic';
|
|
||||||
export { markers } from './stories/markers';
|
|
||||||
export { logScale } from './stories/logScale';
|
|
||||||
export { yAxisBounds } from './stories/yAxisBounds';
|
|
||||||
|
|
@ -1,927 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* eslint-disable sort-keys, no-magic-numbers */
|
|
||||||
export default [
|
|
||||||
{
|
|
||||||
key: ['Christopher'],
|
|
||||||
values: [
|
|
||||||
{
|
|
||||||
x: -157766400000.0,
|
|
||||||
y: 24703,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -126230400000.0,
|
|
||||||
y: 27861,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -94694400000.0,
|
|
||||||
y: 29436,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -63158400000.0,
|
|
||||||
y: 31463,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -31536000000.0,
|
|
||||||
y: 35718,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 0.0,
|
|
||||||
y: 41758,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 31536000000.0,
|
|
||||||
y: 48172,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 63072000000.0,
|
|
||||||
y: 52092,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 94694400000.0,
|
|
||||||
y: 48217,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 126230400000.0,
|
|
||||||
y: 48476,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 157766400000.0,
|
|
||||||
y: 46438,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 189302400000.0,
|
|
||||||
y: 45086,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 220924800000.0,
|
|
||||||
y: 46610,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 252460800000.0,
|
|
||||||
y: 47107,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 283996800000.0,
|
|
||||||
y: 50514,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 315532800000.0,
|
|
||||||
y: 48969,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 347155200000.0,
|
|
||||||
y: 50108,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 378691200000.0,
|
|
||||||
y: 59055,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 410227200000.0,
|
|
||||||
y: 59188,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 441763200000.0,
|
|
||||||
y: 59859,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 473385600000.0,
|
|
||||||
y: 59516,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 504921600000.0,
|
|
||||||
y: 56633,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 536457600000.0,
|
|
||||||
y: 54466,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 567993600000.0,
|
|
||||||
y: 52996,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 599616000000.0,
|
|
||||||
y: 53205,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 631152000000.0,
|
|
||||||
y: 52322,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 662688000000.0,
|
|
||||||
y: 47109,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 694224000000.0,
|
|
||||||
y: 42470,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 725846400000.0,
|
|
||||||
y: 38257,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 757382400000.0,
|
|
||||||
y: 34823,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 788918400000.0,
|
|
||||||
y: 32728,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 820454400000.0,
|
|
||||||
y: 30988,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 852076800000.0,
|
|
||||||
y: 29179,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 883612800000.0,
|
|
||||||
y: 27083,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 915148800000.0,
|
|
||||||
y: 25700,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 946684800000.0,
|
|
||||||
y: 24959,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 978307200000.0,
|
|
||||||
y: 23180,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1009843200000.0,
|
|
||||||
y: 21731,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1041379200000.0,
|
|
||||||
y: 20793,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1072915200000.0,
|
|
||||||
y: 19739,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1104537600000.0,
|
|
||||||
y: 19190,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1136073600000.0,
|
|
||||||
y: 19674,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1167609600000.0,
|
|
||||||
y: 19986,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1199145600000.0,
|
|
||||||
y: 17771,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: ['David'],
|
|
||||||
values: [
|
|
||||||
{
|
|
||||||
x: -157766400000.0,
|
|
||||||
y: 67646,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -126230400000.0,
|
|
||||||
y: 66207,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -94694400000.0,
|
|
||||||
y: 66581,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -63158400000.0,
|
|
||||||
y: 63531,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -31536000000.0,
|
|
||||||
y: 63502,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 0.0,
|
|
||||||
y: 61570,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 31536000000.0,
|
|
||||||
y: 52948,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 63072000000.0,
|
|
||||||
y: 46218,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 94694400000.0,
|
|
||||||
y: 40968,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 126230400000.0,
|
|
||||||
y: 41654,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 157766400000.0,
|
|
||||||
y: 39019,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 189302400000.0,
|
|
||||||
y: 39165,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 220924800000.0,
|
|
||||||
y: 40407,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 252460800000.0,
|
|
||||||
y: 40533,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 283996800000.0,
|
|
||||||
y: 41898,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 315532800000.0,
|
|
||||||
y: 41743,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 347155200000.0,
|
|
||||||
y: 40486,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 378691200000.0,
|
|
||||||
y: 40283,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 410227200000.0,
|
|
||||||
y: 39048,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 441763200000.0,
|
|
||||||
y: 38346,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 473385600000.0,
|
|
||||||
y: 38395,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 504921600000.0,
|
|
||||||
y: 37021,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 536457600000.0,
|
|
||||||
y: 36672,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 567993600000.0,
|
|
||||||
y: 35214,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 599616000000.0,
|
|
||||||
y: 35139,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 631152000000.0,
|
|
||||||
y: 33661,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 662688000000.0,
|
|
||||||
y: 30347,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 694224000000.0,
|
|
||||||
y: 28344,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 725846400000.0,
|
|
||||||
y: 26947,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 757382400000.0,
|
|
||||||
y: 24784,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 788918400000.0,
|
|
||||||
y: 22967,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 820454400000.0,
|
|
||||||
y: 22941,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 852076800000.0,
|
|
||||||
y: 21824,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 883612800000.0,
|
|
||||||
y: 20816,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 915148800000.0,
|
|
||||||
y: 20267,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 946684800000.0,
|
|
||||||
y: 19695,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 978307200000.0,
|
|
||||||
y: 19281,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1009843200000.0,
|
|
||||||
y: 18600,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1041379200000.0,
|
|
||||||
y: 18557,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1072915200000.0,
|
|
||||||
y: 18315,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1104537600000.0,
|
|
||||||
y: 18017,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1136073600000.0,
|
|
||||||
y: 17510,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1167609600000.0,
|
|
||||||
y: 17400,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1199145600000.0,
|
|
||||||
y: 16049,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: ['James'],
|
|
||||||
values: [
|
|
||||||
{
|
|
||||||
x: -157766400000.0,
|
|
||||||
y: 67506,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -126230400000.0,
|
|
||||||
y: 65036,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -94694400000.0,
|
|
||||||
y: 61554,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -63158400000.0,
|
|
||||||
y: 60584,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -31536000000.0,
|
|
||||||
y: 59824,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 0.0,
|
|
||||||
y: 61597,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 31536000000.0,
|
|
||||||
y: 54463,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 63072000000.0,
|
|
||||||
y: 46960,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 94694400000.0,
|
|
||||||
y: 42782,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 126230400000.0,
|
|
||||||
y: 41258,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 157766400000.0,
|
|
||||||
y: 39471,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 189302400000.0,
|
|
||||||
y: 38203,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 220924800000.0,
|
|
||||||
y: 39916,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 252460800000.0,
|
|
||||||
y: 39783,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 283996800000.0,
|
|
||||||
y: 39237,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 315532800000.0,
|
|
||||||
y: 39185,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 347155200000.0,
|
|
||||||
y: 38176,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 378691200000.0,
|
|
||||||
y: 38750,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 410227200000.0,
|
|
||||||
y: 36228,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 441763200000.0,
|
|
||||||
y: 35728,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 473385600000.0,
|
|
||||||
y: 35750,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 504921600000.0,
|
|
||||||
y: 33955,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 536457600000.0,
|
|
||||||
y: 32552,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 567993600000.0,
|
|
||||||
y: 32418,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 599616000000.0,
|
|
||||||
y: 32658,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 631152000000.0,
|
|
||||||
y: 32288,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 662688000000.0,
|
|
||||||
y: 30460,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 694224000000.0,
|
|
||||||
y: 28450,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 725846400000.0,
|
|
||||||
y: 26193,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 757382400000.0,
|
|
||||||
y: 24706,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 788918400000.0,
|
|
||||||
y: 22691,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 820454400000.0,
|
|
||||||
y: 21122,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 852076800000.0,
|
|
||||||
y: 20368,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 883612800000.0,
|
|
||||||
y: 19651,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 915148800000.0,
|
|
||||||
y: 18508,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 946684800000.0,
|
|
||||||
y: 17939,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 978307200000.0,
|
|
||||||
y: 17023,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1009843200000.0,
|
|
||||||
y: 16905,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1041379200000.0,
|
|
||||||
y: 16832,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1072915200000.0,
|
|
||||||
y: 16459,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1104537600000.0,
|
|
||||||
y: 16046,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1136073600000.0,
|
|
||||||
y: 16139,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1167609600000.0,
|
|
||||||
y: 15821,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1199145600000.0,
|
|
||||||
y: 14920,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: ['John'],
|
|
||||||
values: [
|
|
||||||
{
|
|
||||||
x: -157766400000.0,
|
|
||||||
y: 71390,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -126230400000.0,
|
|
||||||
y: 64858,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -94694400000.0,
|
|
||||||
y: 61480,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -63158400000.0,
|
|
||||||
y: 60754,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -31536000000.0,
|
|
||||||
y: 58644,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 0.0,
|
|
||||||
y: 58348,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 31536000000.0,
|
|
||||||
y: 51382,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 63072000000.0,
|
|
||||||
y: 43028,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 94694400000.0,
|
|
||||||
y: 39061,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 126230400000.0,
|
|
||||||
y: 37553,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 157766400000.0,
|
|
||||||
y: 34970,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 189302400000.0,
|
|
||||||
y: 33876,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 220924800000.0,
|
|
||||||
y: 34103,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 252460800000.0,
|
|
||||||
y: 33895,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 283996800000.0,
|
|
||||||
y: 35305,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 315532800000.0,
|
|
||||||
y: 35131,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 347155200000.0,
|
|
||||||
y: 34761,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 378691200000.0,
|
|
||||||
y: 34560,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 410227200000.0,
|
|
||||||
y: 33047,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 441763200000.0,
|
|
||||||
y: 32484,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 473385600000.0,
|
|
||||||
y: 31397,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 504921600000.0,
|
|
||||||
y: 30103,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 536457600000.0,
|
|
||||||
y: 29462,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 567993600000.0,
|
|
||||||
y: 29301,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 599616000000.0,
|
|
||||||
y: 29751,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 631152000000.0,
|
|
||||||
y: 29011,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 662688000000.0,
|
|
||||||
y: 27727,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 694224000000.0,
|
|
||||||
y: 26156,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 725846400000.0,
|
|
||||||
y: 24918,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 757382400000.0,
|
|
||||||
y: 24119,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 788918400000.0,
|
|
||||||
y: 23174,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 820454400000.0,
|
|
||||||
y: 22104,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 852076800000.0,
|
|
||||||
y: 21330,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 883612800000.0,
|
|
||||||
y: 20556,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 915148800000.0,
|
|
||||||
y: 20280,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 946684800000.0,
|
|
||||||
y: 20032,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 978307200000.0,
|
|
||||||
y: 18839,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1009843200000.0,
|
|
||||||
y: 17400,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1041379200000.0,
|
|
||||||
y: 17170,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1072915200000.0,
|
|
||||||
y: 16381,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1104537600000.0,
|
|
||||||
y: 15692,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1136073600000.0,
|
|
||||||
y: 15083,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1167609600000.0,
|
|
||||||
y: 14348,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1199145600000.0,
|
|
||||||
y: 13110,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: ['Michael'],
|
|
||||||
values: [
|
|
||||||
{
|
|
||||||
x: -157766400000.0,
|
|
||||||
y: 80812,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -126230400000.0,
|
|
||||||
y: 79709,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -94694400000.0,
|
|
||||||
y: 82204,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -63158400000.0,
|
|
||||||
y: 81785,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: -31536000000.0,
|
|
||||||
y: 84893,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 0.0,
|
|
||||||
y: 85015,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 31536000000.0,
|
|
||||||
y: 77321,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 63072000000.0,
|
|
||||||
y: 71197,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 94694400000.0,
|
|
||||||
y: 67598,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 126230400000.0,
|
|
||||||
y: 67304,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 157766400000.0,
|
|
||||||
y: 68149,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 189302400000.0,
|
|
||||||
y: 66686,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 220924800000.0,
|
|
||||||
y: 67344,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 252460800000.0,
|
|
||||||
y: 66875,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 283996800000.0,
|
|
||||||
y: 67473,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 315532800000.0,
|
|
||||||
y: 68375,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 347155200000.0,
|
|
||||||
y: 68467,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 378691200000.0,
|
|
||||||
y: 67904,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 410227200000.0,
|
|
||||||
y: 67708,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 441763200000.0,
|
|
||||||
y: 67457,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 473385600000.0,
|
|
||||||
y: 64667,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 504921600000.0,
|
|
||||||
y: 63959,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 536457600000.0,
|
|
||||||
y: 63442,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 567993600000.0,
|
|
||||||
y: 63924,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 599616000000.0,
|
|
||||||
y: 65233,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 631152000000.0,
|
|
||||||
y: 65138,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 662688000000.0,
|
|
||||||
y: 60646,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 694224000000.0,
|
|
||||||
y: 54216,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 725846400000.0,
|
|
||||||
y: 49443,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 757382400000.0,
|
|
||||||
y: 44361,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 788918400000.0,
|
|
||||||
y: 41311,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 820454400000.0,
|
|
||||||
y: 38284,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 852076800000.0,
|
|
||||||
y: 37459,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 883612800000.0,
|
|
||||||
y: 36525,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 915148800000.0,
|
|
||||||
y: 33820,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 946684800000.0,
|
|
||||||
y: 31956,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 978307200000.0,
|
|
||||||
y: 29612,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1009843200000.0,
|
|
||||||
y: 28156,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1041379200000.0,
|
|
||||||
y: 27031,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1072915200000.0,
|
|
||||||
y: 25418,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1104537600000.0,
|
|
||||||
y: 23678,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1136073600000.0,
|
|
||||||
y: 22498,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1167609600000.0,
|
|
||||||
y: 21805,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 1199145600000.0,
|
|
||||||
y: 20271,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { SuperChart, VizType } from '@superset-ui/core';
|
|
||||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
|
||||||
import data from '../data';
|
|
||||||
|
|
||||||
export const basic = () => (
|
|
||||||
<SuperChart
|
|
||||||
chartType={VizType.LegacyLine}
|
|
||||||
width={400}
|
|
||||||
height={400}
|
|
||||||
datasource={dummyDatasource}
|
|
||||||
queriesData={[{ data }]}
|
|
||||||
formData={{
|
|
||||||
bottomMargin: 'auto',
|
|
||||||
colorScheme: 'd3Category10',
|
|
||||||
leftMargin: 'auto',
|
|
||||||
lineInterpolation: 'linear',
|
|
||||||
richTooltip: true,
|
|
||||||
showBrush: 'auto',
|
|
||||||
showLegend: true,
|
|
||||||
showMarkers: false,
|
|
||||||
vizType: VizType.LegacyLine,
|
|
||||||
xAxisFormat: 'smart_date',
|
|
||||||
xAxisLabel: '',
|
|
||||||
xAxisShowminmax: false,
|
|
||||||
xTicksLayout: 'auto',
|
|
||||||
yAxisBounds: [null, null],
|
|
||||||
yAxisFormat: '.3s',
|
|
||||||
yAxisLabel: '',
|
|
||||||
yAxisShowminmax: false,
|
|
||||||
yLogScale: false,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { SuperChart, VizType } from '@superset-ui/core';
|
|
||||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
|
||||||
import data from '../data';
|
|
||||||
|
|
||||||
export const logScale = () => (
|
|
||||||
<SuperChart
|
|
||||||
chartType={VizType.LegacyLine}
|
|
||||||
width={400}
|
|
||||||
height={400}
|
|
||||||
datasource={dummyDatasource}
|
|
||||||
queriesData={[{ data }]}
|
|
||||||
formData={{
|
|
||||||
richTooltip: true,
|
|
||||||
vizType: VizType.LegacyLine,
|
|
||||||
yAxisBounds: [1, 60000],
|
|
||||||
yAxisFormat: ',d',
|
|
||||||
yLogScale: true,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { SuperChart, VizType } from '@superset-ui/core';
|
|
||||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
|
||||||
import data from '../data';
|
|
||||||
|
|
||||||
export const markers = () => (
|
|
||||||
<SuperChart
|
|
||||||
chartType={VizType.LegacyLine}
|
|
||||||
width={400}
|
|
||||||
height={400}
|
|
||||||
datasource={dummyDatasource}
|
|
||||||
queriesData={[{ data }]}
|
|
||||||
formData={{
|
|
||||||
bottomMargin: 'auto',
|
|
||||||
colorScheme: 'd3Category10',
|
|
||||||
leftMargin: 'auto',
|
|
||||||
lineInterpolation: 'linear',
|
|
||||||
richTooltip: true,
|
|
||||||
showBrush: 'auto',
|
|
||||||
showLegend: true,
|
|
||||||
showMarkers: true,
|
|
||||||
vizType: VizType.LegacyLine,
|
|
||||||
xAxisFormat: 'smart_date',
|
|
||||||
xAxisLabel: '',
|
|
||||||
xAxisShowminmax: false,
|
|
||||||
xTicksLayout: 'auto',
|
|
||||||
yAxisBounds: [null, null],
|
|
||||||
yAxisFormat: '.3s',
|
|
||||||
yAxisLabel: '',
|
|
||||||
yAxisShowminmax: false,
|
|
||||||
yLogScale: false,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
@ -1,97 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { SuperChart, VizType } from '@superset-ui/core';
|
|
||||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
|
||||||
import data from '../data';
|
|
||||||
|
|
||||||
export const yAxisBounds = () => (
|
|
||||||
<div className="container">
|
|
||||||
<h2>yAxisBounds</h2>
|
|
||||||
<pre>yAxisBounds=undefined</pre>
|
|
||||||
<SuperChart
|
|
||||||
chartType={VizType.LegacyLine}
|
|
||||||
width={400}
|
|
||||||
height={200}
|
|
||||||
datasource={dummyDatasource}
|
|
||||||
queriesData={[{ data }]}
|
|
||||||
formData={{
|
|
||||||
richTooltip: true,
|
|
||||||
showLegend: false,
|
|
||||||
vizType: VizType.LegacyLine,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<pre>yAxisBounds=[0, 60000]</pre>
|
|
||||||
<SuperChart
|
|
||||||
chartType={VizType.LegacyLine}
|
|
||||||
width={400}
|
|
||||||
height={200}
|
|
||||||
datasource={dummyDatasource}
|
|
||||||
queriesData={[{ data }]}
|
|
||||||
formData={{
|
|
||||||
richTooltip: true,
|
|
||||||
showLegend: false,
|
|
||||||
vizType: VizType.LegacyLine,
|
|
||||||
yAxisBounds: [0, 60000],
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<pre>yAxisBounds=[null, 60000]</pre>
|
|
||||||
<SuperChart
|
|
||||||
chartType={VizType.LegacyLine}
|
|
||||||
width={400}
|
|
||||||
height={200}
|
|
||||||
datasource={dummyDatasource}
|
|
||||||
queriesData={[{ data }]}
|
|
||||||
formData={{
|
|
||||||
richTooltip: true,
|
|
||||||
showLegend: false,
|
|
||||||
vizType: VizType.LegacyLine,
|
|
||||||
yAxisBounds: [null, 60000],
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<pre>yAxisBounds=[40000, null]</pre>
|
|
||||||
<SuperChart
|
|
||||||
chartType={VizType.LegacyLine}
|
|
||||||
width={400}
|
|
||||||
height={200}
|
|
||||||
datasource={dummyDatasource}
|
|
||||||
queriesData={[{ data }]}
|
|
||||||
formData={{
|
|
||||||
richTooltip: true,
|
|
||||||
showLegend: false,
|
|
||||||
vizType: VizType.LegacyLine,
|
|
||||||
yAxisBounds: [40000, null],
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<pre>yAxisBounds=[40000, null] with Legend</pre>
|
|
||||||
<SuperChart
|
|
||||||
chartType={VizType.LegacyLine}
|
|
||||||
width={400}
|
|
||||||
height={200}
|
|
||||||
datasource={dummyDatasource}
|
|
||||||
queriesData={[{ data }]}
|
|
||||||
formData={{
|
|
||||||
richTooltip: true,
|
|
||||||
showLegend: true,
|
|
||||||
vizType: VizType.LegacyLine,
|
|
||||||
yAxisBounds: [40000, null],
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { VizType } from '@superset-ui/core';
|
|
||||||
import { PieChartPlugin } from '@superset-ui/legacy-preset-chart-nvd3';
|
|
||||||
|
|
||||||
new PieChartPlugin().configure({ key: VizType.Pie }).register();
|
|
||||||
|
|
||||||
export default {
|
|
||||||
title: 'Legacy Chart Plugins/legacy-preset-chart-nvd3/Pie',
|
|
||||||
};
|
|
||||||
|
|
||||||
export { basic } from './stories/basic';
|
|
||||||
export { noData } from './stories/noData';
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* eslint-disable sort-keys, no-magic-numbers */
|
|
||||||
export default [
|
|
||||||
{
|
|
||||||
x: 'boy',
|
|
||||||
y: 48133355,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: 'girl',
|
|
||||||
y: 32546308,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { SuperChart, VizType } from '@superset-ui/core';
|
|
||||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
|
||||||
import data from '../data';
|
|
||||||
|
|
||||||
export const basic = () => (
|
|
||||||
<SuperChart
|
|
||||||
chartType={VizType.Pie}
|
|
||||||
width={400}
|
|
||||||
height={400}
|
|
||||||
datasource={dummyDatasource}
|
|
||||||
queriesData={[{ data }]}
|
|
||||||
formData={{
|
|
||||||
colorScheme: 'd3Category10',
|
|
||||||
donut: false,
|
|
||||||
labelsOutside: true,
|
|
||||||
numberFormat: '.3s',
|
|
||||||
pieLabelType: 'key',
|
|
||||||
showLabels: true,
|
|
||||||
showLegend: true,
|
|
||||||
vizType: VizType.Pie,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { SuperChart, VizType } from '@superset-ui/core';
|
|
||||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
|
||||||
|
|
||||||
export const noData = () => (
|
|
||||||
<SuperChart
|
|
||||||
chartType={VizType.Pie}
|
|
||||||
width={400}
|
|
||||||
height={400}
|
|
||||||
datasource={dummyDatasource}
|
|
||||||
queriesData={[{ data: [] }]}
|
|
||||||
formData={{
|
|
||||||
colorScheme: 'd3Category10',
|
|
||||||
donut: false,
|
|
||||||
labelsOutside: true,
|
|
||||||
numberFormat: '.3s',
|
|
||||||
pieLabelType: 'key',
|
|
||||||
showLabels: true,
|
|
||||||
showLegend: true,
|
|
||||||
vizType: VizType.Pie,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
@ -23,7 +23,6 @@ import {
|
||||||
SupersetClient,
|
SupersetClient,
|
||||||
} from '@superset-ui/core';
|
} from '@superset-ui/core';
|
||||||
import { BigNumberChartPlugin } from '@superset-ui/plugin-chart-echarts';
|
import { BigNumberChartPlugin } from '@superset-ui/plugin-chart-echarts';
|
||||||
import LegacySankeyPlugin from '@superset-ui/legacy-plugin-chart-sankey';
|
|
||||||
import { WordCloudChartPlugin } from '@superset-ui/plugin-chart-word-cloud';
|
import { WordCloudChartPlugin } from '@superset-ui/plugin-chart-word-cloud';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|
@ -44,8 +43,6 @@ const WORD_CLOUD = 'new_word_cloud';
|
||||||
|
|
||||||
new BigNumberChartPlugin().configure({ key: BIG_NUMBER }).register();
|
new BigNumberChartPlugin().configure({ key: BIG_NUMBER }).register();
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
new LegacySankeyPlugin().configure({ key: SANKEY }).register();
|
|
||||||
// eslint-disable-next-line
|
|
||||||
new WordCloudChartPlugin().configure({ key: WORD_CLOUD }).register();
|
new WordCloudChartPlugin().configure({ key: WORD_CLOUD }).register();
|
||||||
|
|
||||||
const VIS_TYPES = [BIG_NUMBER, SANKEY, SUNBURST, WORD_CLOUD, WORD_CLOUD_LEGACY];
|
const VIS_TYPES = [BIG_NUMBER, SANKEY, SUNBURST, WORD_CLOUD, WORD_CLOUD_LEGACY];
|
||||||
|
|
|
||||||
|
|
@ -1,51 +0,0 @@
|
||||||
<!--
|
|
||||||
Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
or more contributor license agreements. See the NOTICE file
|
|
||||||
distributed with this work for additional information
|
|
||||||
regarding copyright ownership. The ASF licenses this file
|
|
||||||
to you under the Apache License, Version 2.0 (the
|
|
||||||
"License"); you may not use this file except in compliance
|
|
||||||
with the License. You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing,
|
|
||||||
software distributed under the License is distributed on an
|
|
||||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
KIND, either express or implied. See the License for the
|
|
||||||
specific language governing permissions and limitations
|
|
||||||
under the License.
|
|
||||||
-->
|
|
||||||
|
|
||||||
# Change Log
|
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
||||||
|
|
||||||
# [0.20.0](https://github.com/apache/superset/compare/v2021.41.0...v0.20.0) (2024-09-09)
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
- **generic-chart-axes:** set x-axis if unset and ff is enabled ([#20107](https://github.com/apache/superset/issues/20107)) ([0b3d3dd](https://github.com/apache/superset/commit/0b3d3dd4caa7f4c31c1ba7229966a40ba0469e85))
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
- **explore:** Frontend implementation of dataset creation from infobox ([#19855](https://github.com/apache/superset/issues/19855)) ([ba0c37d](https://github.com/apache/superset/commit/ba0c37d3df85b1af39404af1d578daeb0ff2d278))
|
|
||||||
|
|
||||||
# [0.19.0](https://github.com/apache/superset/compare/v2021.41.0...v0.19.0) (2024-09-07)
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
- **generic-chart-axes:** set x-axis if unset and ff is enabled ([#20107](https://github.com/apache/superset/issues/20107)) ([0b3d3dd](https://github.com/apache/superset/commit/0b3d3dd4caa7f4c31c1ba7229966a40ba0469e85))
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
- **explore:** Frontend implementation of dataset creation from infobox ([#19855](https://github.com/apache/superset/issues/19855)) ([ba0c37d](https://github.com/apache/superset/commit/ba0c37d3df85b1af39404af1d578daeb0ff2d278))
|
|
||||||
|
|
||||||
# [0.18.0](https://github.com/apache-superset/superset-ui/compare/v0.17.87...v0.18.0) (2021-08-30)
|
|
||||||
|
|
||||||
**Note:** Version bump only for package @superset-ui/legacy-plugin-chart-event-flow
|
|
||||||
|
|
||||||
## [0.17.61](https://github.com/apache-superset/superset-ui/compare/v0.17.60...v0.17.61) (2021-07-02)
|
|
||||||
|
|
||||||
**Note:** Version bump only for package @superset-ui/legacy-plugin-chart-event-flow
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
<!--
|
|
||||||
Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
or more contributor license agreements. See the NOTICE file
|
|
||||||
distributed with this work for additional information
|
|
||||||
regarding copyright ownership. The ASF licenses this file
|
|
||||||
to you under the Apache License, Version 2.0 (the
|
|
||||||
"License"); you may not use this file except in compliance
|
|
||||||
with the License. You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing,
|
|
||||||
software distributed under the License is distributed on an
|
|
||||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
KIND, either express or implied. See the License for the
|
|
||||||
specific language governing permissions and limitations
|
|
||||||
under the License.
|
|
||||||
-->
|
|
||||||
|
|
||||||
## @superset-ui/legacy-plugin-chart-event-flow
|
|
||||||
|
|
||||||
[](https://www.npmjs.com/package/@superset-ui/legacy-plugin-chart-event-flow)
|
|
||||||
[](https://libraries.io/npm/@superset-ui%2Flegacy-plugin-chart-event-flow)
|
|
||||||
|
|
||||||
This plugin provides Event Flow for Superset.
|
|
||||||
|
|
||||||
### Usage
|
|
||||||
|
|
||||||
Configure `key`, which can be any `string`, and register the plugin. This `key` will be used to
|
|
||||||
lookup this chart throughout the app.
|
|
||||||
|
|
||||||
```js
|
|
||||||
import EventFlowChartPlugin from '@superset-ui/legacy-plugin-chart-event-flow';
|
|
||||||
|
|
||||||
new EventFlowChartPlugin().configure({ key: 'event-flow' }).register();
|
|
||||||
```
|
|
||||||
|
|
||||||
Then use it via `SuperChart`. See
|
|
||||||
[storybook](https://apache-superset.github.io/superset-ui-plugins/?selectedKind=plugin-chart-event-flow)
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
```js
|
|
||||||
<SuperChart
|
|
||||||
chartType="event-flow"
|
|
||||||
width={600}
|
|
||||||
height={600}
|
|
||||||
formData={...}
|
|
||||||
queriesData={[{
|
|
||||||
data: {...},
|
|
||||||
}]}
|
|
||||||
/>
|
|
||||||
```
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
{
|
|
||||||
"name": "@superset-ui/legacy-plugin-chart-event-flow",
|
|
||||||
"version": "0.20.3",
|
|
||||||
"description": "Superset Legacy Chart - Event Flow",
|
|
||||||
"sideEffects": [
|
|
||||||
"*.css"
|
|
||||||
],
|
|
||||||
"main": "lib/index.js",
|
|
||||||
"module": "esm/index.js",
|
|
||||||
"files": [
|
|
||||||
"esm",
|
|
||||||
"lib"
|
|
||||||
],
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/apache/superset.git",
|
|
||||||
"directory": "superset-frontend/plugins/legacy-plugin-chart-event-flow"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"superset"
|
|
||||||
],
|
|
||||||
"author": "Superset",
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/apache/superset/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/apache/superset/tree/master/superset-frontend/plugins/legacy-plugin-chart-event-flow#readme",
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@data-ui/event-flow": "^0.0.84",
|
|
||||||
"prop-types": "^15.8.1"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"@superset-ui/chart-controls": "*",
|
|
||||||
"@superset-ui/core": "*",
|
|
||||||
"react": "^15 || ^16"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
import { App as EventFlowApp } from '@data-ui/event-flow';
|
|
||||||
import { t, TimeseriesDataRecord } from '@superset-ui/core';
|
|
||||||
|
|
||||||
export interface EventFlowProps {
|
|
||||||
data: TimeseriesDataRecord[];
|
|
||||||
height: number;
|
|
||||||
width: number;
|
|
||||||
initialMinEventCount: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function EventFlow({
|
|
||||||
data,
|
|
||||||
initialMinEventCount,
|
|
||||||
height = 400,
|
|
||||||
width = 400,
|
|
||||||
}: EventFlowProps) {
|
|
||||||
if (data) {
|
|
||||||
return (
|
|
||||||
<EventFlowApp
|
|
||||||
width={width}
|
|
||||||
height={height}
|
|
||||||
data={data}
|
|
||||||
initialMinEventCount={initialMinEventCount}
|
|
||||||
initialShowControls={false}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div style={{ height, width }}>
|
|
||||||
<div>{t('Sorry, there appears to be no data')}</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,133 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
import { t, validateNonEmpty } from '@superset-ui/core';
|
|
||||||
import {
|
|
||||||
columnChoices,
|
|
||||||
ColumnOption,
|
|
||||||
ColumnMeta,
|
|
||||||
ControlPanelConfig,
|
|
||||||
ControlState,
|
|
||||||
formatSelectOptionsForRange,
|
|
||||||
SelectControlConfig,
|
|
||||||
} from '@superset-ui/chart-controls';
|
|
||||||
|
|
||||||
const config: ControlPanelConfig = {
|
|
||||||
controlPanelSections: [
|
|
||||||
{
|
|
||||||
label: t('Event definition'),
|
|
||||||
controlSetRows: [
|
|
||||||
['entity'],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
name: 'all_columns_x',
|
|
||||||
config: {
|
|
||||||
type: 'SelectControl',
|
|
||||||
label: t('Event Names'),
|
|
||||||
description: t('Columns to display'),
|
|
||||||
mapStateToProps: state => ({
|
|
||||||
choices: columnChoices(state?.datasource),
|
|
||||||
}),
|
|
||||||
// choices is from `mapStateToProps`
|
|
||||||
default: (control: ControlState) =>
|
|
||||||
control.choices?.[0]?.[0] || null,
|
|
||||||
validators: [validateNonEmpty],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
['row_limit'],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
name: 'order_by_entity',
|
|
||||||
config: {
|
|
||||||
type: 'CheckboxControl',
|
|
||||||
label: t('Order by entity id'),
|
|
||||||
description: t(
|
|
||||||
'Important! Select this if the table is not already sorted by entity id, ' +
|
|
||||||
'else there is no guarantee that all events for each entity are returned.',
|
|
||||||
),
|
|
||||||
default: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
name: 'min_leaf_node_event_count',
|
|
||||||
config: {
|
|
||||||
type: 'SelectControl',
|
|
||||||
freeForm: false,
|
|
||||||
label: t('Minimum leaf node event count'),
|
|
||||||
default: 1,
|
|
||||||
choices: formatSelectOptionsForRange(1, 10),
|
|
||||||
description: t(
|
|
||||||
'Leaf nodes that represent fewer than this number of events will be initially ' +
|
|
||||||
'hidden in the visualization',
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: t('Query'),
|
|
||||||
expanded: true,
|
|
||||||
controlSetRows: [['adhoc_filters']],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: t('Additional metadata'),
|
|
||||||
controlSetRows: [
|
|
||||||
[
|
|
||||||
{
|
|
||||||
name: 'all_columns',
|
|
||||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
||||||
config: {
|
|
||||||
type: 'SelectControl',
|
|
||||||
multi: true,
|
|
||||||
label: t('Metadata'),
|
|
||||||
default: [],
|
|
||||||
description: t('Select any columns for metadata inspection'),
|
|
||||||
optionRenderer: c => <ColumnOption showType column={c} />,
|
|
||||||
valueRenderer: c => <ColumnOption column={c} />,
|
|
||||||
valueKey: 'column_name',
|
|
||||||
allowAll: true,
|
|
||||||
mapStateToProps: state => ({
|
|
||||||
options: state.datasource?.columns || [],
|
|
||||||
}),
|
|
||||||
commaChoosesOption: false,
|
|
||||||
freeForm: true,
|
|
||||||
} as SelectControlConfig<ColumnMeta>,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
controlOverrides: {
|
|
||||||
entity: {
|
|
||||||
label: t('Entity ID'),
|
|
||||||
description: t('e.g., a "user id" column'),
|
|
||||||
},
|
|
||||||
row_limit: {
|
|
||||||
label: t('Max Events'),
|
|
||||||
description: t(
|
|
||||||
'The maximum number of events to return, equivalent to the number of rows',
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export default config;
|
|
||||||
|
Before Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 26 KiB |
|
|
@ -1,46 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
import { t, ChartMetadata, ChartPlugin } from '@superset-ui/core';
|
|
||||||
import thumbnail from './images/thumbnail.png';
|
|
||||||
import example from './images/example.jpg';
|
|
||||||
import controlPanel from './controlPanel';
|
|
||||||
|
|
||||||
const metadata = new ChartMetadata({
|
|
||||||
category: t('Flow'),
|
|
||||||
credits: ['https://github.com/williaster/data-ui'],
|
|
||||||
description: t(
|
|
||||||
'Compares the lengths of time different activities take in a shared timeline view.',
|
|
||||||
),
|
|
||||||
exampleGallery: [{ url: example }],
|
|
||||||
name: t('Event Flow'),
|
|
||||||
tags: [t('Legacy'), t('Progressive')],
|
|
||||||
thumbnail,
|
|
||||||
useLegacyApi: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
export default class EventFlowChartPlugin extends ChartPlugin {
|
|
||||||
constructor() {
|
|
||||||
super({
|
|
||||||
loadChart: () => import('./EventFlow'),
|
|
||||||
loadTransformProps: () => import('./transformProps'),
|
|
||||||
metadata,
|
|
||||||
controlPanel,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,70 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
import { ChartProps, TimeseriesDataRecord } from '@superset-ui/core';
|
|
||||||
import { cleanEvents, TS, EVENT_NAME, ENTITY_ID } from '@data-ui/event-flow';
|
|
||||||
|
|
||||||
export interface EventFlowFormData {
|
|
||||||
allColumnsX: string;
|
|
||||||
entity: string;
|
|
||||||
minLeafNodeEventCount: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface EventFlowChartProps extends ChartProps {
|
|
||||||
formData: EventFlowFormData;
|
|
||||||
queriesData: {
|
|
||||||
data: TimeseriesDataRecord[];
|
|
||||||
}[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function transformProps(chartProps: ChartProps) {
|
|
||||||
const { formData, queriesData, width, height } =
|
|
||||||
chartProps as EventFlowChartProps;
|
|
||||||
const { allColumnsX, entity, minLeafNodeEventCount } = formData;
|
|
||||||
const { data } = queriesData[0];
|
|
||||||
|
|
||||||
const hasData = data && data.length > 0;
|
|
||||||
if (hasData) {
|
|
||||||
const userKey = entity;
|
|
||||||
const eventNameKey = allColumnsX;
|
|
||||||
|
|
||||||
// map from the Superset form fields to <EventFlow />'s expected data keys
|
|
||||||
const accessorFunctions = {
|
|
||||||
[ENTITY_ID]: (datum: TimeseriesDataRecord) => String(datum[userKey]),
|
|
||||||
[EVENT_NAME]: (datum: TimeseriesDataRecord) =>
|
|
||||||
datum[eventNameKey] as string,
|
|
||||||
[TS]: (datum: TimeseriesDataRecord): Date | null =>
|
|
||||||
// eslint-disable-next-line no-underscore-dangle
|
|
||||||
datum.__timestamp || datum.__timestamp === 0
|
|
||||||
? // eslint-disable-next-line no-underscore-dangle
|
|
||||||
new Date(datum.__timestamp)
|
|
||||||
: null,
|
|
||||||
};
|
|
||||||
|
|
||||||
const cleanData = cleanEvents(data, accessorFunctions);
|
|
||||||
|
|
||||||
return {
|
|
||||||
data: cleanData,
|
|
||||||
height,
|
|
||||||
initialMinEventCount: minLeafNodeEventCount,
|
|
||||||
width,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return { data: null, height, width };
|
|
||||||
}
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare module '*.png';
|
|
||||||
declare module '*.jpg';
|
|
||||||
declare module '@data-ui/event-flow';
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"declarationDir": "lib",
|
|
||||||
"outDir": "lib",
|
|
||||||
"rootDir": "src"
|
|
||||||
},
|
|
||||||
"exclude": [
|
|
||||||
"lib",
|
|
||||||
"test"
|
|
||||||
],
|
|
||||||
"extends": "../../tsconfig.json",
|
|
||||||
"include": [
|
|
||||||
"src/**/*",
|
|
||||||
"types/**/*",
|
|
||||||
"../../types/**/*"
|
|
||||||
],
|
|
||||||
"references": [
|
|
||||||
{
|
|
||||||
"path": "../../packages/superset-ui-chart-controls"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "../../packages/superset-ui-core"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
@ -1,83 +0,0 @@
|
||||||
<!--
|
|
||||||
Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
or more contributor license agreements. See the NOTICE file
|
|
||||||
distributed with this work for additional information
|
|
||||||
regarding copyright ownership. The ASF licenses this file
|
|
||||||
to you under the Apache License, Version 2.0 (the
|
|
||||||
"License"); you may not use this file except in compliance
|
|
||||||
with the License. You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing,
|
|
||||||
software distributed under the License is distributed on an
|
|
||||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
KIND, either express or implied. See the License for the
|
|
||||||
specific language governing permissions and limitations
|
|
||||||
under the License.
|
|
||||||
-->
|
|
||||||
|
|
||||||
# Change Log
|
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
||||||
|
|
||||||
# [0.20.0](https://github.com/apache/superset/compare/v2021.41.0...v0.20.0) (2024-09-09)
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
- **chart & heatmap:** make to fix that y label is rendering out of bounds ([#20011](https://github.com/apache/superset/issues/20011)) ([56e9695](https://github.com/apache/superset/commit/56e96950c17ec65ef18cedfb2ed6591796a96cfc))
|
|
||||||
- Date column in Heatmap is displayed as unix timestamp ([#25009](https://github.com/apache/superset/issues/25009)) ([35eb66a](https://github.com/apache/superset/commit/35eb66a322f7938f840778633a4aea11c7f24dce))
|
|
||||||
- **explore:** Prevent shared controls from checking feature flags outside React render ([#21315](https://github.com/apache/superset/issues/21315)) ([2285ebe](https://github.com/apache/superset/commit/2285ebe72ec4edded6d195052740b7f9f13d1f1b))
|
|
||||||
- Heatmap numeric sorting ([#27360](https://github.com/apache/superset/issues/27360)) ([fe2f5a7](https://github.com/apache/superset/commit/fe2f5a7be9fb6218aa72ab9173481fd21fa40b20))
|
|
||||||
- **heatmap:** add detail descriptions for heatmap 'normalize across' ([#20566](https://github.com/apache/superset/issues/20566)) ([d925b0c](https://github.com/apache/superset/commit/d925b0c8835fb1773b80298a3de1bdc368c88850))
|
|
||||||
- **legacy-plugin-chart-heatmap:** fix adhoc column tooltip ([#23507](https://github.com/apache/superset/issues/23507)) ([0cebe8b](https://github.com/apache/superset/commit/0cebe8bf18204d17f311345744e67c4bf5961083))
|
|
||||||
- **select:** select component sort functionality on certain options ([#17638](https://github.com/apache/superset/issues/17638)) ([f476ba2](https://github.com/apache/superset/commit/f476ba23a279cb87a94ad3075e035cad0ae264b6))
|
|
||||||
- Timeseries Y-axis format with contribution mode ([#27106](https://github.com/apache/superset/issues/27106)) ([af577d6](https://github.com/apache/superset/commit/af577d64b17a9730e28e9021376318326fe31437))
|
|
||||||
- Tooltips don't disappear on the Heatmap chart ([#24959](https://github.com/apache/superset/issues/24959)) ([9703490](https://github.com/apache/superset/commit/97034901291420af844257fc76ac107d4a891f18))
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
- Add currencies controls in control panels ([#24718](https://github.com/apache/superset/issues/24718)) ([f7e76d0](https://github.com/apache/superset/commit/f7e76d02b7cbe4940946673590bb979984ace9f5))
|
|
||||||
- Adds the ECharts Heatmap chart ([#25353](https://github.com/apache/superset/issues/25353)) ([546d48a](https://github.com/apache/superset/commit/546d48adbb84b1354d6a3d4ae88dbeba0ad14d44))
|
|
||||||
- **chart & legend:** make to enable show legend by default ([#19927](https://github.com/apache/superset/issues/19927)) ([7b3d0f0](https://github.com/apache/superset/commit/7b3d0f040b050905f7d0901d0227f1cd6b761b56))
|
|
||||||
- **explore:** Apply denormalization to tier 2 charts form data ([#20524](https://github.com/apache/superset/issues/20524)) ([e12ee59](https://github.com/apache/superset/commit/e12ee59b13822241dca8d8015f1222c477edd4f3))
|
|
||||||
- Implement support for currencies in more charts ([#24594](https://github.com/apache/superset/issues/24594)) ([d74d7ec](https://github.com/apache/superset/commit/d74d7eca23a3c94bc48af082c115d34c103e815d))
|
|
||||||
|
|
||||||
### Reverts
|
|
||||||
|
|
||||||
- Revert "chore(deps): bump d3-svg-legend in /superset-frontend (#19846)" (#19972) ([f144de4](https://github.com/apache/superset/commit/f144de4ee2bf213bb7e17f903bd3975d504c4136)), closes [#19846](https://github.com/apache/superset/issues/19846) [#19972](https://github.com/apache/superset/issues/19972)
|
|
||||||
|
|
||||||
# [0.19.0](https://github.com/apache/superset/compare/v2021.41.0...v0.19.0) (2024-09-07)
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
- **chart & heatmap:** make to fix that y label is rendering out of bounds ([#20011](https://github.com/apache/superset/issues/20011)) ([56e9695](https://github.com/apache/superset/commit/56e96950c17ec65ef18cedfb2ed6591796a96cfc))
|
|
||||||
- Date column in Heatmap is displayed as unix timestamp ([#25009](https://github.com/apache/superset/issues/25009)) ([35eb66a](https://github.com/apache/superset/commit/35eb66a322f7938f840778633a4aea11c7f24dce))
|
|
||||||
- **explore:** Prevent shared controls from checking feature flags outside React render ([#21315](https://github.com/apache/superset/issues/21315)) ([2285ebe](https://github.com/apache/superset/commit/2285ebe72ec4edded6d195052740b7f9f13d1f1b))
|
|
||||||
- Heatmap numeric sorting ([#27360](https://github.com/apache/superset/issues/27360)) ([fe2f5a7](https://github.com/apache/superset/commit/fe2f5a7be9fb6218aa72ab9173481fd21fa40b20))
|
|
||||||
- **heatmap:** add detail descriptions for heatmap 'normalize across' ([#20566](https://github.com/apache/superset/issues/20566)) ([d925b0c](https://github.com/apache/superset/commit/d925b0c8835fb1773b80298a3de1bdc368c88850))
|
|
||||||
- **legacy-plugin-chart-heatmap:** fix adhoc column tooltip ([#23507](https://github.com/apache/superset/issues/23507)) ([0cebe8b](https://github.com/apache/superset/commit/0cebe8bf18204d17f311345744e67c4bf5961083))
|
|
||||||
- **select:** select component sort functionality on certain options ([#17638](https://github.com/apache/superset/issues/17638)) ([f476ba2](https://github.com/apache/superset/commit/f476ba23a279cb87a94ad3075e035cad0ae264b6))
|
|
||||||
- Timeseries Y-axis format with contribution mode ([#27106](https://github.com/apache/superset/issues/27106)) ([af577d6](https://github.com/apache/superset/commit/af577d64b17a9730e28e9021376318326fe31437))
|
|
||||||
- Tooltips don't disappear on the Heatmap chart ([#24959](https://github.com/apache/superset/issues/24959)) ([9703490](https://github.com/apache/superset/commit/97034901291420af844257fc76ac107d4a891f18))
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
- Add currencies controls in control panels ([#24718](https://github.com/apache/superset/issues/24718)) ([f7e76d0](https://github.com/apache/superset/commit/f7e76d02b7cbe4940946673590bb979984ace9f5))
|
|
||||||
- Adds the ECharts Heatmap chart ([#25353](https://github.com/apache/superset/issues/25353)) ([546d48a](https://github.com/apache/superset/commit/546d48adbb84b1354d6a3d4ae88dbeba0ad14d44))
|
|
||||||
- **chart & legend:** make to enable show legend by default ([#19927](https://github.com/apache/superset/issues/19927)) ([7b3d0f0](https://github.com/apache/superset/commit/7b3d0f040b050905f7d0901d0227f1cd6b761b56))
|
|
||||||
- **explore:** Apply denormalization to tier 2 charts form data ([#20524](https://github.com/apache/superset/issues/20524)) ([e12ee59](https://github.com/apache/superset/commit/e12ee59b13822241dca8d8015f1222c477edd4f3))
|
|
||||||
- Implement support for currencies in more charts ([#24594](https://github.com/apache/superset/issues/24594)) ([d74d7ec](https://github.com/apache/superset/commit/d74d7eca23a3c94bc48af082c115d34c103e815d))
|
|
||||||
|
|
||||||
### Reverts
|
|
||||||
|
|
||||||
- Revert "chore(deps): bump d3-svg-legend in /superset-frontend (#19846)" (#19972) ([f144de4](https://github.com/apache/superset/commit/f144de4ee2bf213bb7e17f903bd3975d504c4136)), closes [#19846](https://github.com/apache/superset/issues/19846) [#19972](https://github.com/apache/superset/issues/19972)
|
|
||||||
|
|
||||||
# [0.18.0](https://github.com/apache-superset/superset-ui/compare/v0.17.87...v0.18.0) (2021-08-30)
|
|
||||||
|
|
||||||
**Note:** Version bump only for package @superset-ui/legacy-plugin-chart-heatmap
|
|
||||||
|
|
||||||
## [0.17.61](https://github.com/apache-superset/superset-ui/compare/v0.17.60...v0.17.61) (2021-07-02)
|
|
||||||
|
|
||||||
**Note:** Version bump only for package @superset-ui/legacy-plugin-chart-heatmap
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
<!--
|
|
||||||
Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
or more contributor license agreements. See the NOTICE file
|
|
||||||
distributed with this work for additional information
|
|
||||||
regarding copyright ownership. The ASF licenses this file
|
|
||||||
to you under the Apache License, Version 2.0 (the
|
|
||||||
"License"); you may not use this file except in compliance
|
|
||||||
with the License. You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing,
|
|
||||||
software distributed under the License is distributed on an
|
|
||||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
KIND, either express or implied. See the License for the
|
|
||||||
specific language governing permissions and limitations
|
|
||||||
under the License.
|
|
||||||
-->
|
|
||||||
|
|
||||||
## @superset-ui/legacy-plugin-chart-heatmap
|
|
||||||
|
|
||||||
[](https://www.npmjs.com/package/@superset-ui/legacy-plugin-chart-heatmap)
|
|
||||||
[](https://libraries.io/npm/@superset-ui%2Flegacy-plugin-chart-heatmap)
|
|
||||||
|
|
||||||
This plugin provides Heatmap for Superset.
|
|
||||||
|
|
||||||
### Usage
|
|
||||||
|
|
||||||
Configure `key`, which can be any `string`, and register the plugin. This `key` will be used to
|
|
||||||
lookup this chart throughout the app.
|
|
||||||
|
|
||||||
```js
|
|
||||||
import HeatmapChartPlugin from '@superset-ui/legacy-plugin-chart-heatmap';
|
|
||||||
|
|
||||||
new HeatmapChartPlugin().configure({ key: 'heatmap' }).register();
|
|
||||||
```
|
|
||||||
|
|
||||||
Then use it via `SuperChart`. See
|
|
||||||
[storybook](https://apache-superset.github.io/superset-ui-plugins/?selectedKind=plugin-chart-heatmap)
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
```js
|
|
||||||
<SuperChart
|
|
||||||
chartType="heatmap"
|
|
||||||
width={600}
|
|
||||||
height={600}
|
|
||||||
formData={...}
|
|
||||||
queriesData={[{
|
|
||||||
data: {...},
|
|
||||||
}]}
|
|
||||||
/>
|
|
||||||
```
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
{
|
|
||||||
"name": "@superset-ui/legacy-plugin-chart-heatmap",
|
|
||||||
"version": "0.20.3",
|
|
||||||
"description": "Superset Legacy Chart - Heatmap",
|
|
||||||
"keywords": [
|
|
||||||
"superset"
|
|
||||||
],
|
|
||||||
"homepage": "https://github.com/apache/superset/tree/master/superset-frontend/plugins/legacy-plugin-chart-heatmap#readme",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/apache/superset/issues"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/apache/superset.git",
|
|
||||||
"directory": "superset-frontend/plugins/legacy-plugin-chart-heatmap"
|
|
||||||
},
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"author": "Superset",
|
|
||||||
"main": "lib/index.js",
|
|
||||||
"module": "esm/index.js",
|
|
||||||
"files": [
|
|
||||||
"esm",
|
|
||||||
"lib"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"d3": "^3.5.17",
|
|
||||||
"d3-svg-legend": "^1.x",
|
|
||||||
"d3-tip": "^0.9.1",
|
|
||||||
"prop-types": "^15.8.1"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"@emotion/react": "^11.4.1",
|
|
||||||
"@superset-ui/chart-controls": "*",
|
|
||||||
"@superset-ui/core": "*",
|
|
||||||
"react": "^16.13.1"
|
|
||||||
},
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,458 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
/* eslint-disable func-names, react/sort-prop-types */
|
|
||||||
import d3 from 'd3';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import 'd3-svg-legend';
|
|
||||||
import d3tip from 'd3-tip';
|
|
||||||
import {
|
|
||||||
getColumnLabel,
|
|
||||||
getMetricLabel,
|
|
||||||
getNumberFormatter,
|
|
||||||
NumberFormats,
|
|
||||||
getSequentialSchemeRegistry,
|
|
||||||
} from '@superset-ui/core';
|
|
||||||
|
|
||||||
const propTypes = {
|
|
||||||
data: PropTypes.shape({
|
|
||||||
records: PropTypes.arrayOf(
|
|
||||||
PropTypes.shape({
|
|
||||||
x: PropTypes.string,
|
|
||||||
y: PropTypes.string,
|
|
||||||
v: PropTypes.number,
|
|
||||||
perc: PropTypes.number,
|
|
||||||
rank: PropTypes.number,
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
extents: PropTypes.arrayOf(PropTypes.number),
|
|
||||||
}),
|
|
||||||
width: PropTypes.number,
|
|
||||||
height: PropTypes.number,
|
|
||||||
bottomMargin: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
||||||
colorScheme: PropTypes.string,
|
|
||||||
columnX: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
||||||
columnY: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
||||||
leftMargin: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
||||||
metric: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
|
|
||||||
normalized: PropTypes.bool,
|
|
||||||
valueFormatter: PropTypes.object,
|
|
||||||
showLegend: PropTypes.bool,
|
|
||||||
showPercentage: PropTypes.bool,
|
|
||||||
showValues: PropTypes.bool,
|
|
||||||
sortXAxis: PropTypes.string,
|
|
||||||
sortYAxis: PropTypes.string,
|
|
||||||
xScaleInterval: PropTypes.number,
|
|
||||||
yScaleInterval: PropTypes.number,
|
|
||||||
yAxisBounds: PropTypes.arrayOf(PropTypes.number),
|
|
||||||
};
|
|
||||||
|
|
||||||
function cmp(a, b) {
|
|
||||||
return a > b ? 1 : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
const DEFAULT_PROPERTIES = {
|
|
||||||
minChartWidth: 150,
|
|
||||||
minChartHeight: 150,
|
|
||||||
marginLeft: 35,
|
|
||||||
marginBottom: 35,
|
|
||||||
marginTop: 10,
|
|
||||||
marginRight: 10,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Inspired from http://bl.ocks.org/mbostock/3074470
|
|
||||||
// https://jsfiddle.net/cyril123/h0reyumq/
|
|
||||||
function Heatmap(element, props) {
|
|
||||||
const {
|
|
||||||
data,
|
|
||||||
width,
|
|
||||||
height,
|
|
||||||
bottomMargin,
|
|
||||||
canvasImageRendering,
|
|
||||||
colorScheme,
|
|
||||||
columnX,
|
|
||||||
columnY,
|
|
||||||
leftMargin,
|
|
||||||
metric,
|
|
||||||
normalized,
|
|
||||||
valueFormatter,
|
|
||||||
showLegend,
|
|
||||||
showPercentage,
|
|
||||||
showValues,
|
|
||||||
sortXAxis,
|
|
||||||
sortYAxis,
|
|
||||||
xScaleInterval,
|
|
||||||
yScaleInterval,
|
|
||||||
yAxisBounds,
|
|
||||||
xAxisFormatter,
|
|
||||||
yAxisFormatter,
|
|
||||||
} = props;
|
|
||||||
|
|
||||||
const { extents } = data;
|
|
||||||
const records = data.records.map(record => ({
|
|
||||||
...record,
|
|
||||||
x: xAxisFormatter(record.x),
|
|
||||||
y: yAxisFormatter(record.y),
|
|
||||||
}));
|
|
||||||
|
|
||||||
const margin = {
|
|
||||||
top: 10,
|
|
||||||
right: 10,
|
|
||||||
bottom: 35,
|
|
||||||
left: 35,
|
|
||||||
};
|
|
||||||
|
|
||||||
let showY = true;
|
|
||||||
let showX = true;
|
|
||||||
const pixelsPerCharX = 4.5; // approx, depends on font size
|
|
||||||
let pixelsPerCharY = 6; // approx, depends on font size
|
|
||||||
|
|
||||||
// Dynamically adjusts based on max x / y category lengths
|
|
||||||
function adjustMargins() {
|
|
||||||
let longestX = 1;
|
|
||||||
let longestY = 1;
|
|
||||||
|
|
||||||
records.forEach(datum => {
|
|
||||||
if (typeof datum.y === 'number') pixelsPerCharY = 7;
|
|
||||||
longestX = Math.max(
|
|
||||||
longestX,
|
|
||||||
(datum.x && datum.x.toString().length) || 1,
|
|
||||||
);
|
|
||||||
longestY = Math.max(
|
|
||||||
longestY,
|
|
||||||
(datum.y && datum.y.toString().length) || 1,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (leftMargin === 'auto') {
|
|
||||||
margin.left = Math.ceil(Math.max(margin.left, pixelsPerCharY * longestY));
|
|
||||||
} else {
|
|
||||||
margin.left = leftMargin;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (showLegend) {
|
|
||||||
margin.right += 40;
|
|
||||||
}
|
|
||||||
|
|
||||||
margin.bottom =
|
|
||||||
bottomMargin === 'auto'
|
|
||||||
? Math.ceil(Math.max(margin.bottom, pixelsPerCharX * longestX))
|
|
||||||
: bottomMargin;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if x axis "x" position is outside of the container and rotate labels 90deg
|
|
||||||
function checkLabelPosition(container) {
|
|
||||||
const xAxisNode = container.select('.x.axis').node();
|
|
||||||
|
|
||||||
if (!xAxisNode) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
xAxisNode.getBoundingClientRect().x + 4 <
|
|
||||||
container.node().getBoundingClientRect().x
|
|
||||||
) {
|
|
||||||
container
|
|
||||||
.selectAll('.x.axis')
|
|
||||||
.selectAll('text')
|
|
||||||
.attr('transform', 'rotate(-90)')
|
|
||||||
.attr('x', -6)
|
|
||||||
.attr('y', 0)
|
|
||||||
.attr('dy', '0.3em');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function ordScale(k, rangeBands, sortMethod, formatter) {
|
|
||||||
let domain = {};
|
|
||||||
records.forEach(d => {
|
|
||||||
domain[d[k]] = (domain[d[k]] || 0) + d.v;
|
|
||||||
});
|
|
||||||
const keys = Object.keys(domain).map(k => formatter(k));
|
|
||||||
if (sortMethod === 'alpha_asc') {
|
|
||||||
domain = keys.sort(cmp);
|
|
||||||
} else if (sortMethod === 'alpha_desc') {
|
|
||||||
domain = keys.sort(cmp).reverse();
|
|
||||||
} else if (sortMethod === 'value_desc') {
|
|
||||||
domain = Object.keys(domain).sort((a, b) =>
|
|
||||||
domain[a] > domain[b] ? -1 : 1,
|
|
||||||
);
|
|
||||||
} else if (sortMethod === 'value_asc') {
|
|
||||||
domain = Object.keys(domain).sort((a, b) =>
|
|
||||||
domain[b] > domain[a] ? -1 : 1,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (k === 'y' && rangeBands) {
|
|
||||||
domain.reverse();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rangeBands) {
|
|
||||||
return d3.scale.ordinal().domain(domain).rangeBands(rangeBands);
|
|
||||||
}
|
|
||||||
|
|
||||||
return d3.scale.ordinal().domain(domain).range(d3.range(domain.length));
|
|
||||||
}
|
|
||||||
|
|
||||||
// eslint-disable-next-line no-param-reassign
|
|
||||||
element.innerHTML = '';
|
|
||||||
const matrix = {};
|
|
||||||
|
|
||||||
adjustMargins();
|
|
||||||
|
|
||||||
let hmWidth = width - (margin.left + margin.right);
|
|
||||||
let hmHeight = height - (margin.bottom + margin.top);
|
|
||||||
const hideYLabel = () => {
|
|
||||||
margin.left =
|
|
||||||
leftMargin === 'auto' ? DEFAULT_PROPERTIES.marginLeft : leftMargin;
|
|
||||||
hmWidth = width - (margin.left + margin.right);
|
|
||||||
showY = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
const hideXLabel = () => {
|
|
||||||
margin.bottom =
|
|
||||||
bottomMargin === 'auto' ? DEFAULT_PROPERTIES.marginBottom : bottomMargin;
|
|
||||||
hmHeight = height - (margin.bottom + margin.top);
|
|
||||||
showX = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Hide Y Labels
|
|
||||||
if (hmWidth < DEFAULT_PROPERTIES.minChartWidth) {
|
|
||||||
hideYLabel();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hide X Labels
|
|
||||||
if (
|
|
||||||
hmHeight < DEFAULT_PROPERTIES.minChartHeight ||
|
|
||||||
hmWidth < DEFAULT_PROPERTIES.minChartWidth
|
|
||||||
) {
|
|
||||||
hideXLabel();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (showY && hmHeight < DEFAULT_PROPERTIES.minChartHeight) {
|
|
||||||
hideYLabel();
|
|
||||||
}
|
|
||||||
|
|
||||||
const fp = getNumberFormatter(NumberFormats.PERCENT_2_POINT);
|
|
||||||
|
|
||||||
const xScale = ordScale('x', null, sortXAxis, xAxisFormatter);
|
|
||||||
const yScale = ordScale('y', null, sortYAxis, yAxisFormatter);
|
|
||||||
const xRbScale = ordScale('x', [0, hmWidth], sortXAxis, xAxisFormatter);
|
|
||||||
const yRbScale = ordScale('y', [hmHeight, 0], sortYAxis, yAxisFormatter);
|
|
||||||
const X = 0;
|
|
||||||
const Y = 1;
|
|
||||||
const heatmapDim = [xRbScale.domain().length, yRbScale.domain().length];
|
|
||||||
|
|
||||||
const minBound = yAxisBounds[0] || 0;
|
|
||||||
const maxBound = yAxisBounds[1] || 1;
|
|
||||||
const colorScale = getSequentialSchemeRegistry()
|
|
||||||
.get(colorScheme)
|
|
||||||
.createLinearScale([minBound, maxBound]);
|
|
||||||
|
|
||||||
const scale = [
|
|
||||||
d3.scale.linear().domain([0, heatmapDim[X]]).range([0, hmWidth]),
|
|
||||||
d3.scale.linear().domain([0, heatmapDim[Y]]).range([0, hmHeight]),
|
|
||||||
];
|
|
||||||
|
|
||||||
const container = d3.select(element);
|
|
||||||
container.classed('superset-legacy-chart-heatmap', true);
|
|
||||||
|
|
||||||
const canvas = container
|
|
||||||
.append('canvas')
|
|
||||||
.attr('width', heatmapDim[X])
|
|
||||||
.attr('height', heatmapDim[Y])
|
|
||||||
.style('width', `${hmWidth}px`)
|
|
||||||
.style('height', `${hmHeight}px`)
|
|
||||||
.style('image-rendering', canvasImageRendering)
|
|
||||||
.style('left', `${margin.left}px`)
|
|
||||||
.style('top', `${margin.top}px`)
|
|
||||||
.style('position', 'absolute');
|
|
||||||
|
|
||||||
const svg = container
|
|
||||||
.append('svg')
|
|
||||||
.attr('width', width)
|
|
||||||
.attr('height', height)
|
|
||||||
.attr('class', 'heatmap-container')
|
|
||||||
.style('position', 'relative');
|
|
||||||
|
|
||||||
if (showValues) {
|
|
||||||
const cells = svg
|
|
||||||
.selectAll('rect')
|
|
||||||
.data(records)
|
|
||||||
.enter()
|
|
||||||
.append('g')
|
|
||||||
.attr('transform', `translate(${margin.left}, ${margin.top})`);
|
|
||||||
|
|
||||||
cells
|
|
||||||
.append('text')
|
|
||||||
.attr('transform', d => `translate(${xRbScale(d.x)}, ${yRbScale(d.y)})`)
|
|
||||||
.attr('y', yRbScale.rangeBand() / 2)
|
|
||||||
.attr('x', xRbScale.rangeBand() / 2)
|
|
||||||
.attr('text-anchor', 'middle')
|
|
||||||
.attr('dy', '.35em')
|
|
||||||
.text(d => valueFormatter(d.v))
|
|
||||||
.attr(
|
|
||||||
'font-size',
|
|
||||||
`${Math.min(yRbScale.rangeBand(), xRbScale.rangeBand()) / 3}px`,
|
|
||||||
)
|
|
||||||
.attr('fill', d => (d.v >= extents[1] / 2 ? 'white' : 'black'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (showLegend) {
|
|
||||||
const colorLegend = d3.legend
|
|
||||||
.color()
|
|
||||||
.labelFormat(valueFormatter)
|
|
||||||
.scale(colorScale)
|
|
||||||
.shapePadding(0)
|
|
||||||
.cells(10)
|
|
||||||
.shapeWidth(10)
|
|
||||||
.shapeHeight(10)
|
|
||||||
.labelOffset(3);
|
|
||||||
|
|
||||||
svg
|
|
||||||
.append('g')
|
|
||||||
.attr('transform', `translate(${width - 40}, ${margin.top})`)
|
|
||||||
.call(colorLegend);
|
|
||||||
}
|
|
||||||
|
|
||||||
const tip = d3tip()
|
|
||||||
.attr('class', 'd3-tip')
|
|
||||||
.offset(function () {
|
|
||||||
const k = d3.mouse(this);
|
|
||||||
const x = k[0] - hmWidth / 2;
|
|
||||||
|
|
||||||
return [k[1] - 20, x];
|
|
||||||
})
|
|
||||||
.html(function () {
|
|
||||||
let s = '';
|
|
||||||
const k = d3.mouse(this);
|
|
||||||
const m = Math.floor(scale[0].invert(k[0]));
|
|
||||||
const n = Math.floor(scale[1].invert(k[1]));
|
|
||||||
if (m in matrix && n in matrix[m]) {
|
|
||||||
const obj = matrix[m][n];
|
|
||||||
s += `<div><b>${getColumnLabel(columnX)}: </b>${obj.x}<div>`;
|
|
||||||
s += `<div><b>${getColumnLabel(columnY)}: </b>${obj.y}<div>`;
|
|
||||||
s += `<div><b>${getMetricLabel(metric)}: </b>${valueFormatter(
|
|
||||||
obj.v,
|
|
||||||
)}<div>`;
|
|
||||||
if (showPercentage) {
|
|
||||||
s += `<div><b>%: </b>${fp(normalized ? obj.rank : obj.perc)}<div>`;
|
|
||||||
}
|
|
||||||
tip.style('display', null);
|
|
||||||
} else {
|
|
||||||
// this is a hack to hide the tooltip because we have map it to a single <rect>
|
|
||||||
// d3-tip toggles opacity and calling hide here is undone by the lib after this call
|
|
||||||
tip.style('display', 'none');
|
|
||||||
}
|
|
||||||
|
|
||||||
return s;
|
|
||||||
});
|
|
||||||
|
|
||||||
const rect = svg
|
|
||||||
.append('g')
|
|
||||||
.attr('transform', `translate(${margin.left}, ${margin.top})`)
|
|
||||||
.append('rect')
|
|
||||||
.classed('background-rect', true)
|
|
||||||
.on('mousemove', tip.show)
|
|
||||||
.on('mouseout', tip.hide)
|
|
||||||
.attr('width', hmWidth)
|
|
||||||
.attr('height', hmHeight);
|
|
||||||
|
|
||||||
rect.call(tip);
|
|
||||||
|
|
||||||
if (showX) {
|
|
||||||
const xAxis = d3.svg
|
|
||||||
.axis()
|
|
||||||
.scale(xRbScale)
|
|
||||||
.outerTickSize(0)
|
|
||||||
.tickValues(xRbScale.domain().filter((d, i) => !(i % xScaleInterval)))
|
|
||||||
.orient('bottom');
|
|
||||||
|
|
||||||
svg
|
|
||||||
.append('g')
|
|
||||||
.attr('class', 'x axis')
|
|
||||||
.attr('transform', `translate(${margin.left},${margin.top + hmHeight})`)
|
|
||||||
.call(xAxis)
|
|
||||||
.selectAll('text')
|
|
||||||
.attr('x', -4)
|
|
||||||
.attr('y', 10)
|
|
||||||
.attr('dy', '0.3em')
|
|
||||||
.style('text-anchor', 'end')
|
|
||||||
.attr('transform', 'rotate(-45)');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (showY) {
|
|
||||||
const yAxis = d3.svg
|
|
||||||
.axis()
|
|
||||||
.scale(yRbScale)
|
|
||||||
.outerTickSize(0)
|
|
||||||
.tickValues(yRbScale.domain().filter((d, i) => !(i % yScaleInterval)))
|
|
||||||
.orient('left');
|
|
||||||
|
|
||||||
svg
|
|
||||||
.append('g')
|
|
||||||
.attr('class', 'y axis')
|
|
||||||
.attr('transform', `translate(${margin.left},${margin.top})`)
|
|
||||||
.call(yAxis);
|
|
||||||
}
|
|
||||||
|
|
||||||
checkLabelPosition(container);
|
|
||||||
const context = canvas.node().getContext('2d');
|
|
||||||
context.imageSmoothingEnabled = false;
|
|
||||||
|
|
||||||
// Compute the pixel colors; scaled by CSS.
|
|
||||||
function createImageObj() {
|
|
||||||
const imageObj = new Image();
|
|
||||||
const image = context.createImageData(heatmapDim[0], heatmapDim[1]);
|
|
||||||
const pixs = {};
|
|
||||||
records.forEach(d => {
|
|
||||||
const c = d3.rgb(colorScale(normalized ? d.rank : d.perc));
|
|
||||||
const x = xScale(d.x);
|
|
||||||
const y = yScale(d.y);
|
|
||||||
pixs[x + y * xScale.domain().length] = c;
|
|
||||||
if (matrix[x] === undefined) {
|
|
||||||
matrix[x] = {};
|
|
||||||
}
|
|
||||||
if (matrix[x][y] === undefined) {
|
|
||||||
matrix[x][y] = d;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
let p = 0;
|
|
||||||
for (let i = 0; i < heatmapDim[0] * heatmapDim[1]; i += 1) {
|
|
||||||
let c = pixs[i];
|
|
||||||
let alpha = 255;
|
|
||||||
if (c === undefined) {
|
|
||||||
c = d3.rgb('#F00');
|
|
||||||
alpha = 0;
|
|
||||||
}
|
|
||||||
image.data[p + 0] = c.r;
|
|
||||||
image.data[p + 1] = c.g;
|
|
||||||
image.data[p + 2] = c.b;
|
|
||||||
image.data[p + 3] = alpha;
|
|
||||||
p += 4;
|
|
||||||
}
|
|
||||||
context.putImageData(image, 0, 0);
|
|
||||||
imageObj.src = canvas.node().toDataURL();
|
|
||||||
}
|
|
||||||
createImageObj();
|
|
||||||
}
|
|
||||||
|
|
||||||
Heatmap.displayName = 'Heatmap';
|
|
||||||
Heatmap.propTypes = propTypes;
|
|
||||||
|
|
||||||
export default Heatmap;
|
|
||||||
|
|
@ -1,152 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
import { reactify, css, styled } from '@superset-ui/core';
|
|
||||||
import { Global } from '@emotion/react';
|
|
||||||
import Component from './Heatmap';
|
|
||||||
|
|
||||||
function componentWillUnmount() {
|
|
||||||
// Removes tooltips from the DOM
|
|
||||||
document.querySelectorAll('.d3-tip').forEach(t => t.remove());
|
|
||||||
}
|
|
||||||
|
|
||||||
const ReactComponent = reactify(Component, { componentWillUnmount });
|
|
||||||
|
|
||||||
const Heatmap = ({ className, ...otherProps }) => (
|
|
||||||
<div className={className}>
|
|
||||||
<Global
|
|
||||||
styles={theme => css`
|
|
||||||
.d3-tip {
|
|
||||||
line-height: 1;
|
|
||||||
padding: ${theme.gridUnit * 3}px;
|
|
||||||
background: ${theme.colors.grayscale.dark2};
|
|
||||||
color: ${theme.colors.grayscale.light5};
|
|
||||||
border-radius: 4px;
|
|
||||||
pointer-events: none;
|
|
||||||
z-index: 1000;
|
|
||||||
font-size: ${theme.typography.sizes.s}px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Creates a small triangle extender for the tooltip */
|
|
||||||
.d3-tip:after {
|
|
||||||
box-sizing: border-box;
|
|
||||||
display: inline;
|
|
||||||
font-size: ${theme.typography.sizes.xs};
|
|
||||||
width: 100%;
|
|
||||||
line-height: 1;
|
|
||||||
color: ${theme.colors.grayscale.dark2};
|
|
||||||
position: absolute;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Northward tooltips */
|
|
||||||
.d3-tip.n:after {
|
|
||||||
content: '\\25BC';
|
|
||||||
margin: -${theme.gridUnit}px 0 0 0;
|
|
||||||
top: 100%;
|
|
||||||
left: 0;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Eastward tooltips */
|
|
||||||
.d3-tip.e:after {
|
|
||||||
content: '\\25C0';
|
|
||||||
margin: -${theme.gridUnit}px 0 0 0;
|
|
||||||
top: 50%;
|
|
||||||
left: -${theme.gridUnit * 2}px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Southward tooltips */
|
|
||||||
.d3-tip.s:after {
|
|
||||||
content: '\\25B2';
|
|
||||||
margin: 0;
|
|
||||||
top: -${theme.gridUnit * 2}px;
|
|
||||||
left: 0;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Westward tooltips */
|
|
||||||
.d3-tip.w:after {
|
|
||||||
content: '\\25B6';
|
|
||||||
margin: -${theme.gridUnit}px 0 0 0px;
|
|
||||||
top: 50%;
|
|
||||||
left: 100%;
|
|
||||||
}
|
|
||||||
`}
|
|
||||||
/>
|
|
||||||
<ReactComponent {...otherProps} />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
export default styled(Heatmap)`
|
|
||||||
${({ theme }) => `
|
|
||||||
.superset-legacy-chart-heatmap {
|
|
||||||
position: relative;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.superset-legacy-chart-heatmap .axis text {
|
|
||||||
font-size: ${theme.typography.sizes.xs}px;
|
|
||||||
text-rendering: optimizeLegibility;
|
|
||||||
}
|
|
||||||
|
|
||||||
.superset-legacy-chart-heatmap .background-rect {
|
|
||||||
stroke: ${theme.colors.grayscale.light2};
|
|
||||||
fill-opacity: 0;
|
|
||||||
pointer-events: all;
|
|
||||||
}
|
|
||||||
|
|
||||||
.superset-legacy-chart-heatmap .axis path,
|
|
||||||
.superset-legacy-chart-heatmap .axis line {
|
|
||||||
fill: none;
|
|
||||||
stroke: ${theme.colors.grayscale.light2};
|
|
||||||
shape-rendering: crispEdges;
|
|
||||||
}
|
|
||||||
|
|
||||||
.superset-legacy-chart-heatmap canvas,
|
|
||||||
.superset-legacy-chart-heatmap img {
|
|
||||||
image-rendering: optimizeSpeed; /* Older versions of FF */
|
|
||||||
image-rendering: -moz-crisp-edges; /* FF 6.0+ */
|
|
||||||
image-rendering: -webkit-optimize-contrast; /* Safari */
|
|
||||||
image-rendering: -o-crisp-edges; /* OS X & Windows Opera (12.02+) */
|
|
||||||
image-rendering: pixelated; /* Awesome future-browsers */
|
|
||||||
-ms-interpolation-mode: nearest-neighbor; /* IE */
|
|
||||||
}
|
|
||||||
|
|
||||||
.superset-legacy-chart-heatmap .legendCells text {
|
|
||||||
font-size: ${theme.typography.sizes.xs}px;
|
|
||||||
font-weight: ${theme.typography.weights.normal};
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.superset-legacy-chart-heatmap .legendCells .cell:first-child text {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.superset-legacy-chart-heatmap .legendCells .cell:last-child text {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dashboard .superset-legacy-chart-heatmap .axis text {
|
|
||||||
font-size: ${theme.typography.sizes.xs}px;
|
|
||||||
opacity: ${theme.opacity.heavy};
|
|
||||||
}
|
|
||||||
`}
|
|
||||||
`;
|
|
||||||
|
|
@ -1,329 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
import { t } from '@superset-ui/core';
|
|
||||||
import {
|
|
||||||
ControlPanelConfig,
|
|
||||||
formatSelectOptionsForRange,
|
|
||||||
sharedControls,
|
|
||||||
getStandardizedControls,
|
|
||||||
D3_TIME_FORMAT_DOCS,
|
|
||||||
} from '@superset-ui/chart-controls';
|
|
||||||
|
|
||||||
const sortAxisChoices = [
|
|
||||||
['alpha_asc', t('Axis ascending')],
|
|
||||||
['alpha_desc', t('Axis descending')],
|
|
||||||
['value_asc', t('Metric ascending')],
|
|
||||||
['value_desc', t('Metric descending')],
|
|
||||||
];
|
|
||||||
|
|
||||||
const dndAllColumns = {
|
|
||||||
...sharedControls.entity,
|
|
||||||
description: t('Columns to display'),
|
|
||||||
};
|
|
||||||
|
|
||||||
const config: ControlPanelConfig = {
|
|
||||||
controlPanelSections: [
|
|
||||||
{
|
|
||||||
label: t('Query'),
|
|
||||||
expanded: true,
|
|
||||||
controlSetRows: [
|
|
||||||
[
|
|
||||||
{
|
|
||||||
name: 'all_columns_x',
|
|
||||||
config: {
|
|
||||||
...dndAllColumns,
|
|
||||||
label: t('X Axis'),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
name: 'all_columns_y',
|
|
||||||
config: {
|
|
||||||
...dndAllColumns,
|
|
||||||
label: t('Y Axis'),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
['metric'],
|
|
||||||
['adhoc_filters'],
|
|
||||||
['row_limit'],
|
|
||||||
['sort_by_metric'],
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: t('Heatmap Options'),
|
|
||||||
expanded: true,
|
|
||||||
tabOverride: 'customize',
|
|
||||||
controlSetRows: [
|
|
||||||
['linear_color_scheme'],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
name: 'xscale_interval',
|
|
||||||
config: {
|
|
||||||
type: 'SelectControl',
|
|
||||||
label: t('XScale Interval'),
|
|
||||||
renderTrigger: true,
|
|
||||||
choices: formatSelectOptionsForRange(1, 50),
|
|
||||||
default: 1,
|
|
||||||
clearable: false,
|
|
||||||
description: t(
|
|
||||||
'Number of steps to take between ticks when displaying the X scale',
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
name: 'yscale_interval',
|
|
||||||
config: {
|
|
||||||
type: 'SelectControl',
|
|
||||||
label: t('YScale Interval'),
|
|
||||||
choices: formatSelectOptionsForRange(1, 50),
|
|
||||||
default: 1,
|
|
||||||
clearable: false,
|
|
||||||
renderTrigger: true,
|
|
||||||
description: t(
|
|
||||||
'Number of steps to take between ticks when displaying the Y scale',
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
name: 'canvas_image_rendering',
|
|
||||||
config: {
|
|
||||||
type: 'SelectControl',
|
|
||||||
label: t('Rendering'),
|
|
||||||
renderTrigger: true,
|
|
||||||
choices: [
|
|
||||||
['pixelated', t('pixelated (Sharp)')],
|
|
||||||
['auto', t('auto (Smooth)')],
|
|
||||||
],
|
|
||||||
default: 'pixelated',
|
|
||||||
description: t(
|
|
||||||
'image-rendering CSS attribute of the canvas object that ' +
|
|
||||||
'defines how the browser scales up the image',
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
name: 'normalize_across',
|
|
||||||
config: {
|
|
||||||
type: 'SelectControl',
|
|
||||||
label: t('Normalize Across'),
|
|
||||||
choices: [
|
|
||||||
['heatmap', t('heatmap')],
|
|
||||||
['x', t('x')],
|
|
||||||
['y', t('y')],
|
|
||||||
],
|
|
||||||
default: 'heatmap',
|
|
||||||
description: (
|
|
||||||
<>
|
|
||||||
<div>
|
|
||||||
{t(
|
|
||||||
'Color will be shaded based the normalized (0% to 100%) value of a given cell against the other cells in the selected range: ',
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
<ul>
|
|
||||||
<li>{t('x: values are normalized within each column')}</li>
|
|
||||||
<li>{t('y: values are normalized within each row')}</li>
|
|
||||||
<li>
|
|
||||||
{t(
|
|
||||||
'heatmap: values are normalized across the entire heatmap',
|
|
||||||
)}
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
name: 'left_margin',
|
|
||||||
config: {
|
|
||||||
type: 'SelectControl',
|
|
||||||
freeForm: true,
|
|
||||||
clearable: false,
|
|
||||||
label: t('Left Margin'),
|
|
||||||
choices: [
|
|
||||||
['auto', t('auto')],
|
|
||||||
[50, '50'],
|
|
||||||
[75, '75'],
|
|
||||||
[100, '100'],
|
|
||||||
[125, '125'],
|
|
||||||
[150, '150'],
|
|
||||||
[200, '200'],
|
|
||||||
],
|
|
||||||
default: 'auto',
|
|
||||||
renderTrigger: true,
|
|
||||||
description: t(
|
|
||||||
'Left margin, in pixels, allowing for more room for axis labels',
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
name: 'bottom_margin',
|
|
||||||
config: {
|
|
||||||
type: 'SelectControl',
|
|
||||||
clearable: false,
|
|
||||||
freeForm: true,
|
|
||||||
label: t('Bottom Margin'),
|
|
||||||
choices: [
|
|
||||||
['auto', t('auto')],
|
|
||||||
[50, '50'],
|
|
||||||
[75, '75'],
|
|
||||||
[100, '100'],
|
|
||||||
[125, '125'],
|
|
||||||
[150, '150'],
|
|
||||||
[200, '200'],
|
|
||||||
],
|
|
||||||
default: 'auto',
|
|
||||||
renderTrigger: true,
|
|
||||||
description: t(
|
|
||||||
'Bottom margin, in pixels, allowing for more room for axis labels',
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
name: 'y_axis_bounds',
|
|
||||||
config: {
|
|
||||||
type: 'BoundsControl',
|
|
||||||
label: t('Value bounds'),
|
|
||||||
renderTrigger: true,
|
|
||||||
default: [null, null],
|
|
||||||
description: t(
|
|
||||||
'Hard value bounds applied for color coding. Is only relevant ' +
|
|
||||||
'and applied when the normalization is applied against the whole heatmap.',
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
['y_axis_format'],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
name: 'time_format',
|
|
||||||
config: {
|
|
||||||
...sharedControls.x_axis_time_format,
|
|
||||||
default: '%d/%m/%Y',
|
|
||||||
description: `${D3_TIME_FORMAT_DOCS}.`,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
['currency_format'],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
name: 'sort_x_axis',
|
|
||||||
config: {
|
|
||||||
type: 'SelectControl',
|
|
||||||
label: t('Sort X Axis'),
|
|
||||||
choices: sortAxisChoices,
|
|
||||||
clearable: false,
|
|
||||||
default: 'alpha_asc',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
name: 'sort_y_axis',
|
|
||||||
config: {
|
|
||||||
type: 'SelectControl',
|
|
||||||
label: t('Sort Y Axis'),
|
|
||||||
choices: sortAxisChoices,
|
|
||||||
clearable: false,
|
|
||||||
default: 'alpha_asc',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
name: 'show_legend',
|
|
||||||
config: {
|
|
||||||
type: 'CheckboxControl',
|
|
||||||
label: t('Legend'),
|
|
||||||
renderTrigger: true,
|
|
||||||
default: true,
|
|
||||||
description: t('Whether to display the legend (toggles)'),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
name: 'show_perc',
|
|
||||||
config: {
|
|
||||||
type: 'CheckboxControl',
|
|
||||||
label: t('Show percentage'),
|
|
||||||
renderTrigger: true,
|
|
||||||
description: t(
|
|
||||||
'Whether to include the percentage in the tooltip',
|
|
||||||
),
|
|
||||||
default: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
name: 'show_values',
|
|
||||||
config: {
|
|
||||||
type: 'CheckboxControl',
|
|
||||||
label: t('Show Values'),
|
|
||||||
renderTrigger: true,
|
|
||||||
default: false,
|
|
||||||
description: t(
|
|
||||||
'Whether to display the numerical values within the cells',
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
name: 'normalized',
|
|
||||||
config: {
|
|
||||||
type: 'CheckboxControl',
|
|
||||||
label: t('Normalized'),
|
|
||||||
renderTrigger: true,
|
|
||||||
description: t(
|
|
||||||
'Whether to apply a normal distribution based on rank on the color scale',
|
|
||||||
),
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
controlOverrides: {
|
|
||||||
y_axis_format: {
|
|
||||||
label: t('Value Format'),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
formDataOverrides: formData => ({
|
|
||||||
...formData,
|
|
||||||
metric: getStandardizedControls().shiftMetric(),
|
|
||||||
}),
|
|
||||||
};
|
|
||||||
|
|
||||||
export default config;
|
|
||||||
|
Before Width: | Height: | Size: 108 KiB |
|
Before Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 124 KiB |
|
Before Width: | Height: | Size: 38 KiB |
|
|
@ -1,65 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
import { t, ChartMetadata, ChartPlugin, ChartLabel } from '@superset-ui/core';
|
|
||||||
import transformProps from './transformProps';
|
|
||||||
import transportation from './images/transportation.jpg';
|
|
||||||
import channels from './images/channels.jpg';
|
|
||||||
import employment from './images/employment.jpg';
|
|
||||||
import thumbnail from './images/thumbnail.png';
|
|
||||||
import controlPanel from './controlPanel';
|
|
||||||
|
|
||||||
const metadata = new ChartMetadata({
|
|
||||||
category: t('Correlation'),
|
|
||||||
credits: ['http://bl.ocks.org/mbostock/3074470'],
|
|
||||||
description: t(
|
|
||||||
'Visualize a related metric across pairs of groups. Heatmaps excel at showcasing the correlation or strength between two groups. Color is used to emphasize the strength of the link between each pair of groups.',
|
|
||||||
),
|
|
||||||
exampleGallery: [
|
|
||||||
{ url: transportation, caption: t('Sizes of vehicles') },
|
|
||||||
{ url: channels, caption: t('Relationships between community channels') },
|
|
||||||
{ url: employment, caption: t('Employment and education') },
|
|
||||||
],
|
|
||||||
label: ChartLabel.DEPRECATED,
|
|
||||||
name: t('Heatmap (legacy)'),
|
|
||||||
tags: [
|
|
||||||
t('Business'),
|
|
||||||
t('Intensity'),
|
|
||||||
t('Legacy'),
|
|
||||||
t('Density'),
|
|
||||||
t('Predictive'),
|
|
||||||
t('Single Metric'),
|
|
||||||
t('Deprecated'),
|
|
||||||
],
|
|
||||||
thumbnail,
|
|
||||||
useLegacyApi: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated in version 4.0.
|
|
||||||
*/
|
|
||||||
export default class HeatmapChartPlugin extends ChartPlugin {
|
|
||||||
constructor() {
|
|
||||||
super({
|
|
||||||
loadChart: () => import('./ReactHeatmap'),
|
|
||||||
metadata,
|
|
||||||
transformProps,
|
|
||||||
controlPanel,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,93 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
import {
|
|
||||||
GenericDataType,
|
|
||||||
getTimeFormatter,
|
|
||||||
getValueFormatter,
|
|
||||||
} from '@superset-ui/core';
|
|
||||||
|
|
||||||
export default function transformProps(chartProps) {
|
|
||||||
const { width, height, formData, queriesData, datasource } = chartProps;
|
|
||||||
const {
|
|
||||||
bottomMargin,
|
|
||||||
canvasImageRendering,
|
|
||||||
allColumnsX,
|
|
||||||
allColumnsY,
|
|
||||||
linearColorScheme,
|
|
||||||
leftMargin,
|
|
||||||
metric,
|
|
||||||
normalized,
|
|
||||||
showLegend,
|
|
||||||
showPerc,
|
|
||||||
showValues,
|
|
||||||
sortXAxis,
|
|
||||||
sortYAxis,
|
|
||||||
xscaleInterval,
|
|
||||||
yscaleInterval,
|
|
||||||
yAxisBounds,
|
|
||||||
yAxisFormat,
|
|
||||||
timeFormat,
|
|
||||||
currencyFormat,
|
|
||||||
} = formData;
|
|
||||||
const { data = [], coltypes = [] } = queriesData[0];
|
|
||||||
const { columnFormats = {}, currencyFormats = {} } = datasource;
|
|
||||||
const valueFormatter = getValueFormatter(
|
|
||||||
metric,
|
|
||||||
currencyFormats,
|
|
||||||
columnFormats,
|
|
||||||
yAxisFormat,
|
|
||||||
currencyFormat,
|
|
||||||
);
|
|
||||||
const xAxisFormatter =
|
|
||||||
coltypes[0] === GenericDataType.Temporal
|
|
||||||
? getTimeFormatter(timeFormat)
|
|
||||||
: coltypes[0] === GenericDataType.Numeric
|
|
||||||
? Number
|
|
||||||
: String;
|
|
||||||
const yAxisFormatter =
|
|
||||||
coltypes[1] === GenericDataType.Temporal
|
|
||||||
? getTimeFormatter(timeFormat)
|
|
||||||
: coltypes[1] === GenericDataType.Numeric
|
|
||||||
? Number
|
|
||||||
: String;
|
|
||||||
return {
|
|
||||||
width,
|
|
||||||
height,
|
|
||||||
data,
|
|
||||||
bottomMargin,
|
|
||||||
canvasImageRendering,
|
|
||||||
colorScheme: linearColorScheme,
|
|
||||||
columnX: allColumnsX,
|
|
||||||
columnY: allColumnsY,
|
|
||||||
leftMargin,
|
|
||||||
metric,
|
|
||||||
normalized,
|
|
||||||
showLegend,
|
|
||||||
showPercentage: showPerc,
|
|
||||||
showValues,
|
|
||||||
sortXAxis,
|
|
||||||
sortYAxis,
|
|
||||||
xScaleInterval: parseInt(xscaleInterval, 10),
|
|
||||||
yScaleInterval: parseInt(yscaleInterval, 10),
|
|
||||||
yAxisBounds,
|
|
||||||
valueFormatter,
|
|
||||||
xAxisFormatter,
|
|
||||||
yAxisFormatter,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"declarationDir": "lib",
|
|
||||||
"outDir": "lib",
|
|
||||||
"rootDir": "src"
|
|
||||||
},
|
|
||||||
"exclude": [
|
|
||||||
"lib",
|
|
||||||
"test"
|
|
||||||
],
|
|
||||||
"extends": "../../tsconfig.json",
|
|
||||||
"include": [
|
|
||||||
"src/**/*",
|
|
||||||
"types/**/*",
|
|
||||||
"../../types/**/*"
|
|
||||||
],
|
|
||||||
"references": [
|
|
||||||
{
|
|
||||||
"path": "../../packages/superset-ui-chart-controls"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "../../packages/superset-ui-core"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
@ -1,63 +0,0 @@
|
||||||
<!--
|
|
||||||
Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
or more contributor license agreements. See the NOTICE file
|
|
||||||
distributed with this work for additional information
|
|
||||||
regarding copyright ownership. The ASF licenses this file
|
|
||||||
to you under the Apache License, Version 2.0 (the
|
|
||||||
"License"); you may not use this file except in compliance
|
|
||||||
with the License. You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing,
|
|
||||||
software distributed under the License is distributed on an
|
|
||||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
KIND, either express or implied. See the License for the
|
|
||||||
specific language governing permissions and limitations
|
|
||||||
under the License.
|
|
||||||
-->
|
|
||||||
|
|
||||||
# Change Log
|
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
||||||
|
|
||||||
# [0.20.0](https://github.com/apache/superset/compare/v2021.41.0...v0.20.0) (2024-09-09)
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
- **Dashboard:** Color inconsistency on refreshes and conflicts ([#27439](https://github.com/apache/superset/issues/27439)) ([313ee59](https://github.com/apache/superset/commit/313ee596f5435894f857d72be7269d5070c8c964))
|
|
||||||
- **explore:** Prevent shared controls from checking feature flags outside React render ([#21315](https://github.com/apache/superset/issues/21315)) ([2285ebe](https://github.com/apache/superset/commit/2285ebe72ec4edded6d195052740b7f9f13d1f1b))
|
|
||||||
- **histogram:** display correct percentile value instead of formula ([#18084](https://github.com/apache/superset/issues/18084)) ([28e729b](https://github.com/apache/superset/commit/28e729b835d8195f3610f7131504441803e43406))
|
|
||||||
- Revert shared controls typing change. ([#22014](https://github.com/apache/superset/issues/22014)) ([4cbd70d](https://github.com/apache/superset/commit/4cbd70db34b140a026ef1a86a8ef0ba3355a350e))
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
- Adds the ECharts Histogram chart ([#28652](https://github.com/apache/superset/issues/28652)) ([896fe85](https://github.com/apache/superset/commit/896fe854dc3865214325cfceea94824ff41a1b6c))
|
|
||||||
- **chart & legend:** make to enable show legend by default ([#19927](https://github.com/apache/superset/issues/19927)) ([7b3d0f0](https://github.com/apache/superset/commit/7b3d0f040b050905f7d0901d0227f1cd6b761b56))
|
|
||||||
- **explore:** Apply denormalization to tier 2 charts form data ([#20524](https://github.com/apache/superset/issues/20524)) ([e12ee59](https://github.com/apache/superset/commit/e12ee59b13822241dca8d8015f1222c477edd4f3))
|
|
||||||
- improve color consistency (save all labels) ([#19038](https://github.com/apache/superset/issues/19038)) ([dc57508](https://github.com/apache/superset/commit/dc575080d7e43d40b1734bb8f44fdc291cb95b11))
|
|
||||||
|
|
||||||
# [0.19.0](https://github.com/apache/superset/compare/v2021.41.0...v0.19.0) (2024-09-07)
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
- **Dashboard:** Color inconsistency on refreshes and conflicts ([#27439](https://github.com/apache/superset/issues/27439)) ([313ee59](https://github.com/apache/superset/commit/313ee596f5435894f857d72be7269d5070c8c964))
|
|
||||||
- **explore:** Prevent shared controls from checking feature flags outside React render ([#21315](https://github.com/apache/superset/issues/21315)) ([2285ebe](https://github.com/apache/superset/commit/2285ebe72ec4edded6d195052740b7f9f13d1f1b))
|
|
||||||
- **histogram:** display correct percentile value instead of formula ([#18084](https://github.com/apache/superset/issues/18084)) ([28e729b](https://github.com/apache/superset/commit/28e729b835d8195f3610f7131504441803e43406))
|
|
||||||
- Revert shared controls typing change. ([#22014](https://github.com/apache/superset/issues/22014)) ([4cbd70d](https://github.com/apache/superset/commit/4cbd70db34b140a026ef1a86a8ef0ba3355a350e))
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
- Adds the ECharts Histogram chart ([#28652](https://github.com/apache/superset/issues/28652)) ([896fe85](https://github.com/apache/superset/commit/896fe854dc3865214325cfceea94824ff41a1b6c))
|
|
||||||
- **chart & legend:** make to enable show legend by default ([#19927](https://github.com/apache/superset/issues/19927)) ([7b3d0f0](https://github.com/apache/superset/commit/7b3d0f040b050905f7d0901d0227f1cd6b761b56))
|
|
||||||
- **explore:** Apply denormalization to tier 2 charts form data ([#20524](https://github.com/apache/superset/issues/20524)) ([e12ee59](https://github.com/apache/superset/commit/e12ee59b13822241dca8d8015f1222c477edd4f3))
|
|
||||||
- improve color consistency (save all labels) ([#19038](https://github.com/apache/superset/issues/19038)) ([dc57508](https://github.com/apache/superset/commit/dc575080d7e43d40b1734bb8f44fdc291cb95b11))
|
|
||||||
|
|
||||||
# [0.18.0](https://github.com/apache-superset/superset-ui/compare/v0.17.87...v0.18.0) (2021-08-30)
|
|
||||||
|
|
||||||
**Note:** Version bump only for package @superset-ui/legacy-plugin-chart-histogram
|
|
||||||
|
|
||||||
## [0.17.61](https://github.com/apache-superset/superset-ui/compare/v0.17.60...v0.17.61) (2021-07-02)
|
|
||||||
|
|
||||||
**Note:** Version bump only for package @superset-ui/legacy-plugin-chart-histogram
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
<!--
|
|
||||||
Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
or more contributor license agreements. See the NOTICE file
|
|
||||||
distributed with this work for additional information
|
|
||||||
regarding copyright ownership. The ASF licenses this file
|
|
||||||
to you under the Apache License, Version 2.0 (the
|
|
||||||
"License"); you may not use this file except in compliance
|
|
||||||
with the License. You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing,
|
|
||||||
software distributed under the License is distributed on an
|
|
||||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
KIND, either express or implied. See the License for the
|
|
||||||
specific language governing permissions and limitations
|
|
||||||
under the License.
|
|
||||||
-->
|
|
||||||
|
|
||||||
## @superset-ui/legacy-plugin-chart-histogram
|
|
||||||
|
|
||||||
[](https://www.npmjs.com/package/@superset-ui/legacy-plugin-chart-histogram)
|
|
||||||
[](https://libraries.io/npm/@superset-ui%2Flegacy-plugin-chart-histogram)
|
|
||||||
|
|
||||||
This plugin provides Histogram for Superset.
|
|
||||||
|
|
||||||
### Usage
|
|
||||||
|
|
||||||
Configure `key`, which can be any `string`, and register the plugin. This `key` will be used to
|
|
||||||
lookup this chart throughout the app.
|
|
||||||
|
|
||||||
```js
|
|
||||||
import HistogramChartPlugin from '@superset-ui/legacy-plugin-chart-histogram';
|
|
||||||
|
|
||||||
new HistogramChartPlugin().configure({ key: 'histogram' }).register();
|
|
||||||
```
|
|
||||||
|
|
||||||
Then use it via `SuperChart`. See
|
|
||||||
[storybook](https://apache-superset.github.io/superset-ui-plugins/?selectedKind=plugin-chart-histogram)
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
```js
|
|
||||||
<SuperChart
|
|
||||||
chartType="histogram"
|
|
||||||
width={600}
|
|
||||||
height={600}
|
|
||||||
formData={...}
|
|
||||||
queriesData={[{
|
|
||||||
data: {...},
|
|
||||||
}]}
|
|
||||||
/>
|
|
||||||
```
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
{
|
|
||||||
"name": "@superset-ui/legacy-plugin-chart-histogram",
|
|
||||||
"version": "0.20.3",
|
|
||||||
"description": "Superset Legacy Chart - Histogram",
|
|
||||||
"sideEffects": [
|
|
||||||
"*.css"
|
|
||||||
],
|
|
||||||
"main": "lib/index.js",
|
|
||||||
"module": "esm/index.js",
|
|
||||||
"files": [
|
|
||||||
"esm",
|
|
||||||
"lib"
|
|
||||||
],
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/apache/superset.git",
|
|
||||||
"directory": "superset-frontend/packages/legacy-plugin-chart-histogram"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"superset"
|
|
||||||
],
|
|
||||||
"author": "Superset",
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/apache/superset/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/apache/superset/tree/master/superset-frontend/plugins/legacy-plugin-chart-histogram#readme",
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@data-ui/histogram": "^0.0.84",
|
|
||||||
"@data-ui/theme": "^0.0.84",
|
|
||||||
"@vx/legend": "^0.0.199",
|
|
||||||
"@vx/responsive": "^0.0.199",
|
|
||||||
"@vx/scale": "^0.0.199",
|
|
||||||
"prop-types": "^15.8.1"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"@superset-ui/chart-controls": "*",
|
|
||||||
"@superset-ui/core": "*",
|
|
||||||
"react": "^15 || ^16"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,160 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
/* eslint-disable react/sort-prop-types */
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import { PureComponent } from 'react';
|
|
||||||
import { Histogram, BarSeries, XAxis, YAxis } from '@data-ui/histogram';
|
|
||||||
import { chartTheme } from '@data-ui/theme';
|
|
||||||
import { LegendOrdinal } from '@vx/legend';
|
|
||||||
import { scaleOrdinal } from '@vx/scale';
|
|
||||||
import { CategoricalColorNamespace, styled, t } from '@superset-ui/core';
|
|
||||||
import WithLegend from './WithLegend';
|
|
||||||
|
|
||||||
const propTypes = {
|
|
||||||
className: PropTypes.string,
|
|
||||||
data: PropTypes.arrayOf(
|
|
||||||
PropTypes.shape({
|
|
||||||
key: PropTypes.string,
|
|
||||||
values: PropTypes.arrayOf(PropTypes.number),
|
|
||||||
}),
|
|
||||||
).isRequired,
|
|
||||||
width: PropTypes.number.isRequired,
|
|
||||||
height: PropTypes.number.isRequired,
|
|
||||||
colorScheme: PropTypes.string,
|
|
||||||
normalized: PropTypes.bool,
|
|
||||||
cumulative: PropTypes.bool,
|
|
||||||
binCount: PropTypes.number,
|
|
||||||
opacity: PropTypes.number,
|
|
||||||
xAxisLabel: PropTypes.string,
|
|
||||||
yAxisLabel: PropTypes.string,
|
|
||||||
showLegend: PropTypes.bool,
|
|
||||||
};
|
|
||||||
const defaultProps = {
|
|
||||||
binCount: 15,
|
|
||||||
className: '',
|
|
||||||
colorScheme: '',
|
|
||||||
normalized: false,
|
|
||||||
cumulative: false,
|
|
||||||
opacity: 1,
|
|
||||||
xAxisLabel: '',
|
|
||||||
yAxisLabel: '',
|
|
||||||
};
|
|
||||||
|
|
||||||
class CustomHistogram extends PureComponent {
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
className,
|
|
||||||
data,
|
|
||||||
width,
|
|
||||||
height,
|
|
||||||
binCount,
|
|
||||||
colorScheme,
|
|
||||||
normalized,
|
|
||||||
cumulative,
|
|
||||||
opacity,
|
|
||||||
xAxisLabel,
|
|
||||||
yAxisLabel,
|
|
||||||
showLegend,
|
|
||||||
sliceId,
|
|
||||||
} = this.props;
|
|
||||||
const colorFn = CategoricalColorNamespace.getScale(colorScheme);
|
|
||||||
const keys = data.map(d => d.key);
|
|
||||||
const colorScale = scaleOrdinal({
|
|
||||||
domain: keys,
|
|
||||||
range: keys.map(x => colorFn(x, sliceId)),
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
|
||||||
<WithLegend
|
|
||||||
className={`superset-legacy-chart-histogram ${className}`}
|
|
||||||
width={width}
|
|
||||||
height={height}
|
|
||||||
position="top"
|
|
||||||
renderLegend={({ direction, style }) =>
|
|
||||||
showLegend && (
|
|
||||||
<LegendOrdinal
|
|
||||||
style={style}
|
|
||||||
scale={colorScale}
|
|
||||||
direction={direction}
|
|
||||||
shape="rect"
|
|
||||||
labelMargin="0 15px 0 0"
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
renderChart={parent => (
|
|
||||||
<Histogram
|
|
||||||
width={parent.width}
|
|
||||||
height={parent.height}
|
|
||||||
ariaLabel="Histogram"
|
|
||||||
normalized={normalized}
|
|
||||||
cumulative={cumulative}
|
|
||||||
binCount={binCount}
|
|
||||||
binType="numeric"
|
|
||||||
margin={{ top: 20, right: 20 }}
|
|
||||||
renderTooltip={({ datum, color }) => (
|
|
||||||
<div>
|
|
||||||
<strong style={{ color }}>
|
|
||||||
{datum.bin0} {t('to')} {datum.bin1}
|
|
||||||
</strong>
|
|
||||||
<div>
|
|
||||||
<strong>{t('count')} </strong>
|
|
||||||
{datum.count}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<strong>{t('cumulative')} </strong>
|
|
||||||
{datum.cumulative}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<strong>{t('percentile (exclusive)')} </strong>
|
|
||||||
{`${(
|
|
||||||
(datum.cumulativeDensity - datum.density) *
|
|
||||||
100
|
|
||||||
).toPrecision(4)}th`}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
valueAccessor={datum => datum}
|
|
||||||
theme={chartTheme}
|
|
||||||
>
|
|
||||||
{data.map(series => (
|
|
||||||
<BarSeries
|
|
||||||
key={series.key}
|
|
||||||
animated
|
|
||||||
rawData={series.values}
|
|
||||||
fill={colorScale(series.key)}
|
|
||||||
fillOpacity={opacity}
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
<XAxis label={xAxisLabel} />
|
|
||||||
<YAxis label={yAxisLabel} />
|
|
||||||
</Histogram>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomHistogram.propTypes = propTypes;
|
|
||||||
CustomHistogram.defaultProps = defaultProps;
|
|
||||||
|
|
||||||
export default styled(CustomHistogram)`
|
|
||||||
.superset-legacy-chart-histogram {
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
@ -1,153 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
/* eslint-disable react/sort-prop-types, react/jsx-sort-default-props */
|
|
||||||
import { Component } from 'react';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import { ParentSize } from '@vx/responsive';
|
|
||||||
|
|
||||||
const propTypes = {
|
|
||||||
className: PropTypes.string,
|
|
||||||
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
||||||
height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
||||||
renderChart: PropTypes.func.isRequired,
|
|
||||||
renderLegend: PropTypes.func.isRequired,
|
|
||||||
position: PropTypes.oneOf(['top', 'left', 'bottom', 'right']),
|
|
||||||
legendJustifyContent: PropTypes.oneOf(['center', 'flex-start', 'flex-end']),
|
|
||||||
};
|
|
||||||
const defaultProps = {
|
|
||||||
className: '',
|
|
||||||
width: 'auto',
|
|
||||||
height: 'auto',
|
|
||||||
position: 'top',
|
|
||||||
legendJustifyContent: undefined,
|
|
||||||
};
|
|
||||||
|
|
||||||
const LEGEND_STYLE_BASE = {
|
|
||||||
display: 'flex',
|
|
||||||
flexGrow: 0,
|
|
||||||
flexShrink: 0,
|
|
||||||
order: -1,
|
|
||||||
paddingTop: '5px',
|
|
||||||
fontSize: '0.9em',
|
|
||||||
};
|
|
||||||
|
|
||||||
const CHART_STYLE_BASE = {
|
|
||||||
flexGrow: 1,
|
|
||||||
flexShrink: 1,
|
|
||||||
flexBasis: 'auto',
|
|
||||||
position: 'relative',
|
|
||||||
};
|
|
||||||
|
|
||||||
class WithLegend extends Component {
|
|
||||||
getContainerDirection() {
|
|
||||||
const { position } = this.props;
|
|
||||||
switch (position) {
|
|
||||||
case 'left':
|
|
||||||
return 'row';
|
|
||||||
case 'right':
|
|
||||||
return 'row-reverse';
|
|
||||||
case 'bottom':
|
|
||||||
return 'column-reverse';
|
|
||||||
default:
|
|
||||||
case 'top':
|
|
||||||
return 'column';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getLegendJustifyContent() {
|
|
||||||
const { legendJustifyContent, position } = this.props;
|
|
||||||
if (legendJustifyContent) {
|
|
||||||
return legendJustifyContent;
|
|
||||||
}
|
|
||||||
switch (position) {
|
|
||||||
case 'left':
|
|
||||||
return 'flex-start';
|
|
||||||
case 'right':
|
|
||||||
return 'flex-start';
|
|
||||||
case 'bottom':
|
|
||||||
return 'flex-end';
|
|
||||||
default:
|
|
||||||
case 'top':
|
|
||||||
return 'flex-end';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const { className, width, height, position, renderChart, renderLegend } =
|
|
||||||
this.props;
|
|
||||||
|
|
||||||
const isHorizontal = position === 'left' || position === 'right';
|
|
||||||
|
|
||||||
const style = {
|
|
||||||
display: 'flex',
|
|
||||||
flexDirection: this.getContainerDirection(),
|
|
||||||
};
|
|
||||||
if (width) {
|
|
||||||
style.width = width;
|
|
||||||
}
|
|
||||||
if (height) {
|
|
||||||
style.height = height;
|
|
||||||
}
|
|
||||||
|
|
||||||
const chartStyle = { ...CHART_STYLE_BASE };
|
|
||||||
if (isHorizontal) {
|
|
||||||
chartStyle.width = 0;
|
|
||||||
} else {
|
|
||||||
chartStyle.height = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const legendDirection = isHorizontal ? 'column' : 'row';
|
|
||||||
const legendStyle = {
|
|
||||||
...LEGEND_STYLE_BASE,
|
|
||||||
flexDirection: legendDirection,
|
|
||||||
justifyContent: this.getLegendJustifyContent(),
|
|
||||||
};
|
|
||||||
const legendContainerStyle = {
|
|
||||||
flexWrap: 'wrap',
|
|
||||||
display: 'flex',
|
|
||||||
flexDirection: legendDirection,
|
|
||||||
};
|
|
||||||
return (
|
|
||||||
<div className={`with-legend ${className}`} style={style}>
|
|
||||||
<div className="legend-container" style={legendStyle}>
|
|
||||||
{renderLegend({
|
|
||||||
// Pass flexDirection for @vx/legend to arrange legend items
|
|
||||||
direction: legendDirection,
|
|
||||||
style: legendContainerStyle,
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
<div className="main-container" style={chartStyle}>
|
|
||||||
<ParentSize>
|
|
||||||
{parent =>
|
|
||||||
parent.width > 0 && parent.height > 0
|
|
||||||
? // Only render when necessary
|
|
||||||
renderChart(parent)
|
|
||||||
: null
|
|
||||||
}
|
|
||||||
</ParentSize>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
WithLegend.propTypes = propTypes;
|
|
||||||
WithLegend.defaultProps = defaultProps;
|
|
||||||
|
|
||||||
export default WithLegend;
|
|
||||||
|
|
@ -1,152 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
import { t, validateNonEmpty } from '@superset-ui/core';
|
|
||||||
import {
|
|
||||||
columnChoices,
|
|
||||||
ControlPanelConfig,
|
|
||||||
ControlPanelState,
|
|
||||||
formatSelectOptions,
|
|
||||||
getStandardizedControls,
|
|
||||||
sharedControls,
|
|
||||||
ControlState,
|
|
||||||
} from '@superset-ui/chart-controls';
|
|
||||||
|
|
||||||
const columnsConfig = {
|
|
||||||
...sharedControls.columns,
|
|
||||||
label: t('Columns'),
|
|
||||||
description: t('Select the numeric columns to draw the histogram'),
|
|
||||||
mapStateToProps: (state: ControlPanelState, controlState: ControlState) => ({
|
|
||||||
...(sharedControls.columns.mapStateToProps?.(state, controlState) || {}),
|
|
||||||
choices: columnChoices(state.datasource),
|
|
||||||
}),
|
|
||||||
validators: [validateNonEmpty],
|
|
||||||
};
|
|
||||||
|
|
||||||
const config: ControlPanelConfig = {
|
|
||||||
controlPanelSections: [
|
|
||||||
{
|
|
||||||
label: t('Query'),
|
|
||||||
expanded: true,
|
|
||||||
controlSetRows: [
|
|
||||||
[
|
|
||||||
{
|
|
||||||
name: 'all_columns_x',
|
|
||||||
config: columnsConfig,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
['adhoc_filters'],
|
|
||||||
['row_limit'],
|
|
||||||
['groupby'],
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: t('Chart Options'),
|
|
||||||
expanded: true,
|
|
||||||
controlSetRows: [
|
|
||||||
['color_scheme'],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
name: 'link_length',
|
|
||||||
config: {
|
|
||||||
type: 'SelectControl',
|
|
||||||
renderTrigger: true,
|
|
||||||
freeForm: true,
|
|
||||||
label: t('No of Bins'),
|
|
||||||
default: 5,
|
|
||||||
choices: formatSelectOptions([
|
|
||||||
'10',
|
|
||||||
'25',
|
|
||||||
'50',
|
|
||||||
'75',
|
|
||||||
'100',
|
|
||||||
'150',
|
|
||||||
'200',
|
|
||||||
'250',
|
|
||||||
]),
|
|
||||||
description: t('Select the number of bins for the histogram'),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
name: 'x_axis_label',
|
|
||||||
config: {
|
|
||||||
type: 'TextControl',
|
|
||||||
label: t('X Axis Label'),
|
|
||||||
renderTrigger: true,
|
|
||||||
default: '',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
name: 'y_axis_label',
|
|
||||||
config: {
|
|
||||||
type: 'TextControl',
|
|
||||||
label: t('Y Axis Label'),
|
|
||||||
renderTrigger: true,
|
|
||||||
default: '',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
name: 'show_legend',
|
|
||||||
config: {
|
|
||||||
type: 'CheckboxControl',
|
|
||||||
label: t('Legend'),
|
|
||||||
renderTrigger: true,
|
|
||||||
default: true,
|
|
||||||
description: t('Whether to display the legend (toggles)'),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
name: 'normalized',
|
|
||||||
config: {
|
|
||||||
type: 'CheckboxControl',
|
|
||||||
label: t('Normalized'),
|
|
||||||
renderTrigger: true,
|
|
||||||
description: t('Whether to normalize the histogram'),
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
name: 'cumulative',
|
|
||||||
config: {
|
|
||||||
type: 'CheckboxControl',
|
|
||||||
label: t('Cumulative'),
|
|
||||||
renderTrigger: true,
|
|
||||||
description: t('Whether to make the histogram cumulative'),
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
formDataOverrides: formData => ({
|
|
||||||
...formData,
|
|
||||||
groupby: getStandardizedControls().popAllColumns(),
|
|
||||||
}),
|
|
||||||
};
|
|
||||||
export default config;
|
|
||||||
|
Before Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 23 KiB |