8000 fix: fix issue with chart isBaseOpacity attr by neuqzxy · Pull Request #13 · VisActor/VStory · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

fix: fix issue with chart isBaseOpacity attr #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import VChart, { ISpec } from '@visactor/vchart';
import { IChartAppearAction } from '../../../../types/chart/appear';
import { ICharacterVisactor } from '../../../../../story/character/visactor/interface';
import type { ISpec } from '@visactor/vchart';
import type VChart from '@visactor/vchart';
import type { IChartAppearAction } from '../../../../types/chart/appear';
import type { ICharacterVisactor } from '../../../../../story/character/visactor/interface';
import { axesDisappearProcessor, titleDisappearProcessor } from '../../components';
import { areaDisappearProcessor as areaMarkDisappearProcessor } from '../../marks';
import { graphicDisappearProcessor } from '../../../graphic/disappear';
import { commonDisappearByBaseOpacity } from '../common/commonDisappear';

export const areaDisappearProcessor = async (
chartInstance: ICharacterVisactor,
spec: ISpec,
action: IChartAppearAction
) => {
if (commonDisappearByBaseOpacity(chartInstance, spec, action)) {
return;
}
const chart = chartInstance.getGraphicParent();
const vchart = chart?._vchart;
const instance: VChart = vchart ? vchart : chartInstance;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import VChart, { ISpec } from '@visactor/vchart';
import { IChartAppearAction } from '../../../../types/chart/appear';
import { ICharacterVisactor } from '../../../../../story/character/visactor/interface';
import type { ISpec } from '@visactor/vchart';
import type VChart from '@visactor/vchart';
import type { IChartAppearAction } from '../../../../types/chart/appear';
import type { ICharacterVisactor } from '../../../../../story/character/visactor/interface';

import { axesDisappearProcessor, titleDisappearProcessor } from '../../components';
import { rectDisappearProcessor } from '../../marks';
import { graphicDisappearProcessor } from '../../../graphic/disappear';
import { commonDisappearByBaseOpacity } from '../common/commonDisappear';

export const barDisappearProcessor = async (
chartInstance: ICharacterVisactor,
spec: ISpec,
action: IChartAppearAction
) => {
if (commonDisappearByBaseOpacity(chartInstance, spec, action)) {
return;
}
const chart = chartInstance.getGraphicParent();
const vchart = chart?._vchart;
const instance: VChart = vchart ? vchart : chartInstance;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import VChart, { ISpec } from '@visactor/vchart';
import { IChartAppearAction } from '../../../../types/chart/appear';
import { ICharacterVisactor } from '../../../../../story/character/visactor/interface';
import type { ISpec } from '@visactor/vchart';
import type VChart from '@visactor/vchart';
import type { IChartAppearAction } from '../../../../types/chart/appear';
import type { ICharacterVisactor } from '../../../../../story/character/visactor/interface';
import { graphicDisappearProcessor } from '../../../graphic/disappear';
import { commonDisappearByBaseOpacity } from '../common/commonDisappear';

export const characterDisappearProcessor = async (
chartInstance: ICharacterVisactor,
spec: ISpec,
action: IChartAppearAction
) => {
if (commonDisappearByBaseOpacity(chartInstance, spec, action)) {
return;
}
const chart = chartInstance.getGraphicParent();
const vchart = chart?._vchart;
const instance: VChart = vchart ? vchart : chartInstance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
lineDisappearProcessor as lineMarkDisappearProcessor,
areaDisappearProcessor as areaMarkDisappearProcessor
} from '../../marks';
import type { EasingType } from '@visactor/vrender-core';

export const commonDisappearProcessor = async (
chartInstance: ICharacterVisactor,
Expand Down Expand Up @@ -39,3 +40,29 @@ export const commonDisappearProcessor = async (
visible: false
});
};
export const commonDisappearByBaseOpacity = (
chartInstance: ICharacterVisactor,
spec: ISpec,
action: IChartAppearAction
) => {
const chart = chartInstance.getGraphicParent();
const vchart = chart?._vchart;
const instance: VChart = vchart ? vchart : chartInstance;

if (!instance) {
return;
}

const duration = action.payload.animation?.duration;
const easing = action.payload.animation?.easing;

if (action.payload.fade?.isBaseOpacity) {
chart.setAttributes({
baseOpacity: 1
});

chart.animate().to({ baseOpacity: 0 }, duration, easing as EasingType);
return true;
}
return false;
};
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import VChart, { ISpec } from '@visactor/vchart';
import { IChartAppearAction } from '../../../../types/chart/appear';
import { ICharacterVisactor } from '../../../../../story/character/visactor/interface';
import type { ISpec } from '@visactor/vchart';
import type VChart from '@visactor/vchart';
import type { IChartAppearAction } from '../../../../types/chart/appear';
import type { ICharacterVisactor } from '../../../../../story/character/visactor/interface';

import { axesDisappearProcessor, titleDisappearProcessor } from '../../components';
import { lineDisappearProcessor as lineMarkDisappearProcessor } from '../../marks';
import { graphicDisappearProcessor } from '../../../graphic/disappear';
import { commonDisappearByBaseOpacity } from '../common/commonDisappear';

export const lineDisappearProcessor = async (
chartInstance: ICharacterVisactor,
spec: ISpec,
action: IChartAppearAction
) => {
if (commonDisappearByBaseOpacity(chartInstance, spec, action)) {
return;
}
const chart = chartInstance.getGraphicParent();
const vchart = chart?._vchart;
const instance: VChart = vchart ? vchart : chartInstance;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import VChart, { ISpec } from '@visactor/vchart';
import { IChartAppearAction } from '../../../../types/chart/appear';
import { ICharacterVisactor } from '../../../../../story/character/visactor/interface';
import type { ISpec } from '@visactor/vchart';
import type VChart from '@visactor/vchart';
import type { IChartAppearAction } from '../../../../types/chart/appear';
import type { ICharacterVisactor } from '../../../../../story/character/visactor/interface';

import { axesDisappearProcessor, titleDisappearProcessor } from '../../components';
import { arcDisappearProcessor } from '../../marks';
import { graphicDisappearProcessor } from '../../../graphic/disappear';
import { commonDisappearByBaseOpacity } from '../common/commonDisappear';

export const pieDisappearProcessor = async (
chartInstance: ICharacterVisactor,
spec: ISpec,
action: IChartAppearAction
) => {
if (commonDisappearByBaseOpacity(chartInstance, spec, action)) {
return;
}
const chart = chartInstance.getGraphicParent();
const vchart = chart?._vchart;
const instance: VChart = vchart ? vchart : chartInstance;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import VChart, { ISpec } from '@visactor/vchart';
import { IChartAppearAction } from '../../../../types/chart/appear';
import { ICharacterVisactor } from '../../../../../story/character/visactor/interface';
import type { ISpec } from '@visactor/vchart';
import type VChart from '@visactor/vchart';
import type { IChartAppearAction } from '../../../../types/chart/appear';
import type { ICharacterVisactor } from '../../../../../story/character/visactor/interface';
import { axesDisappearProcessor, titleDisappearProcessor } from '../../components';
import { areaDisappearProcessor, lineDisappearProcessor, symbolDisappearProcessor } from '../../marks';
import { graphicDisappearProcessor } from '../../../graphic/disappear';
import { commonDisappearByBaseOpacity } from '../common/commonDisappear';

export const radarDisappearProcessor = async (
chartInstance: ICharacterVisactor,
spec: ISpec,
action: IChartAppearAction
) => {
if (commonDisappearByBaseOpacity(chartInstance, spec, action)) {
return;
}
const chart = chartInstance.getGraphicParent();
const vchart = chart?._vchart;
const instance: VChart = vchart ? vchart : chartInstance;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import VChart, { ISpec } from '@visactor/vchart';
import { IChartAppearAction } from '../../../../types/chart/appear';
import { ICharacterVisactor } from '../../../../../story/character/visactor/interface';
import type { ISpec } from '@visactor/vchart';
import type VChart from '@visactor/vchart';
import type { IChartAppearAction } from '../../../../types/chart/appear';
import type { ICharacterVisactor } from '../../../../../story/character/visactor/interface';

import { axesDisappearProcessor, titleDisappearProcessor } from '../../components';
import { arcDisappearProcessor } from '../../marks';
import { graphicDisappearProcessor } from '../../../graphic/disappear';
import { commonDisappearByBaseOpacity } from '../common/commonDisappear';

export const roseDisappearProcessor = async (
chartInstance: ICharacterVisactor,
spec: ISpec,
action: IChartAppearAction
) => {
if (commonDisappearByBaseOpacity(chartInstance, spec, action)) {
return;
}
const chart = chartInstance.getGraphicParent();
const vchart = chart?._vchart;
const instance: VChart = vchart ? vchart : chartInstance;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import VChart, { ISpec } from '@visactor/vchart';
import { IChartAppearAction } from '../../../../types/chart/appear';
import { ICharacterVisactor } from '../../../../../story/character/visactor/interface';
import type { ISpec } from '@visactor/vchart';
import type VChart from '@visactor/vchart';
import type { IChartAppearAction } from '../../../../types/chart/appear';
import type { ICharacterVisactor } from '../../../../../story/character/visactor/interface';
import { axesDisappearProcessor, titleDisappearProcessor } from '../../components';
import { symbolDisappearProcessor } from '../../marks';
import { graphicDisappearProcessor } from '../../../graphic/disappear';
import { commonDisappearByBaseOpacity } from '../common/commonDisappear';

export const scatterDisappearProcessor = async (
chartInstance: ICharacterVisactor,
spec: ISpec,
action: IChartAppearAction
) => {
if (commonDisappearByBaseOpacity(chartInstance, spec, action)) {
return;
}
const chart = chartInstance.getGraphicParent();
const vchart = chart?._vchart;
const instance: VChart = vchart ? vchart : chartInstance;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import VChart, { ISpec } from '@visactor/vchart';
import { IChartAppearAction } from '../../../../types/chart/appear';
import { ICharacterVisactor } from '../../../../../story/character/visactor/interface';
import type { ISpec } from '@visactor/vchart';
import type VChart from '@visactor/vchart';
import type { IChartAppearAction } from '../../../../types/chart/appear';
import type { ICharacterVisactor } from '../../../../../story/character/visactor/interface';
import { axesDisappearProcessor, titleDisappearProcessor } from '../../components';
import { arcDisappearProcessor, rectDisappearProcessor } from '../../marks';
import { graphicDisappearProcessor } from '../../../graphic/disappear';
import { commonDisappearByBaseOpacity } from '../common/commonDisappear';

export const sunburstDisappearProcessor = async (
chartInstance: ICharacterVisactor,
spec: ISpec,
action: IChartAppearAction
) => {
if (commonDisappearByBaseOpacity(chartInstance, spec, action)) {
return;
}
const chart = chartInstance.getGraphicParent();
const vchart = chart?._vchart;
const instance: VChart = vchart ? vchart : chartInstance;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import VChart, { ISpec } from '@visactor/vchart';
import { IChartAppearAction } from '../../../../types/chart/appear';
import { ICharacterVisactor } from '../../../../../story/character/visactor/interface';
import type { ISpec } from '@visactor/vchart';
import type VChart from '@visactor/vchart';
import type { IChartAppearAction } from '../../../../types/chart/appear';
import type { ICharacterVisactor } from '../../../../../story/character/visactor/interface';
import { axesDisappearProcessor, titleDisappearProcessor } from '../../components';
import { rectDisappearProcessor } from '../../marks';
import { graphicDisappearProcessor } from '../../../graphic/disappear';
import { commonDisappearByBaseOpacity } from '../common/commonDisappear';

export const treeMapDisappearProcessor = async (
chartInstance: ICharacterVisactor,
spec: ISpec,
action: IChartAppearAction
) => {
if (commonDisappearByBaseOpacity(chartInstance, spec, action)) {
return;
}
const chart = chartInstance.getGraphicParent();
const vchart = chart?._vchart;
const instance: VChart = vchart ? vchart : chartInstance;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import VChart, { ISpec } from '@visactor/vchart';
import { IChartAppearAction } from '../../../../types/chart/appear';
import { ICharacterVisactor } from '../../../../../story/character/visactor/interface';
import type { ISpec } from '@visactor/vchart';
import type VChart from '@visactor/vchart';
import type { IChartAppearAction } from '../../../../types/chart/appear';
import type { ICharacterVisactor } from '../../../../../story/character/visactor/interface';
import { axesDisappearProcessor, titleDisappearProcessor } from '../../components';
import { textDisappearProcessor } from '../../marks';
import { graphicDisappearProcessor } from '../../../graphic/disappear';
import { commonDisappearByBaseOpacity } from '../common/commonDisappear';

export const wordCloudDisappearProcessor = async (
chartInstance: ICharacterVisactor,
spec: ISpec,
action: IChartAppearAction
) => {
if (commonDisappearByBaseOpacity(chartInstance, spec, action)) {
return;
}
const chart = chartInstance.getGraphicParent();
const vchart = chart?._vchart;
const instance: VChart = vchart ? vchart : chartInstance;
Expand Down
1 change: 1 addition & 0 deletions packages/vstory/src/dsl/types/chart/appear.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface IChartAppearPayLoad extends IActionPayload {
*/
effect: string;
};
fade?: { isBaseOpacity?: boolean };
}

export interface IChartAppearAction extends IAction {
Expand Down
Loading
0