mirror of
https://github.com/apache/superset.git
synced 2026-04-18 23:55:00 +00:00
feat: improve color consistency (save all labels) (#19038)
This commit is contained in:
@@ -184,6 +184,7 @@ export default function transformProps(chartProps: ChartProps): EchartsProps {
|
||||
baseEdgeWidth,
|
||||
baseNodeSize,
|
||||
edgeSymbol,
|
||||
sliceId,
|
||||
}: EchartsGraphFormData = { ...DEFAULT_GRAPH_FORM_DATA, ...formData };
|
||||
|
||||
const metricLabel = getMetricLabel(metric);
|
||||
@@ -264,7 +265,7 @@ export default function transformProps(chartProps: ChartProps): EchartsProps {
|
||||
type: 'graph',
|
||||
categories: categoryList.map(c => ({
|
||||
name: c,
|
||||
itemStyle: { color: colorFn(c) },
|
||||
itemStyle: { color: colorFn(c, sliceId) },
|
||||
})),
|
||||
layout,
|
||||
force: {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { QueryFormData } from '@superset-ui/core';
|
||||
import { GraphNodeItemOption } from 'echarts/types/src/chart/graph/GraphSeries';
|
||||
import { SeriesTooltipOption } from 'echarts/types/src/util/types';
|
||||
import {
|
||||
@@ -27,32 +28,34 @@ import {
|
||||
|
||||
export type EdgeSymbol = 'none' | 'circle' | 'arrow';
|
||||
|
||||
export type EchartsGraphFormData = EchartsLegendFormData & {
|
||||
source: string;
|
||||
target: string;
|
||||
sourceCategory?: string;
|
||||
targetCategory?: string;
|
||||
colorScheme?: string;
|
||||
metric?: string;
|
||||
layout?: 'none' | 'circular' | 'force';
|
||||
roam: boolean | 'scale' | 'move';
|
||||
draggable: boolean;
|
||||
selectedMode?: boolean | 'multiple' | 'single';
|
||||
showSymbolThreshold: number;
|
||||
repulsion: number;
|
||||
gravity: number;
|
||||
baseNodeSize: number;
|
||||
baseEdgeWidth: number;
|
||||
edgeLength: number;
|
||||
edgeSymbol: string;
|
||||
friction: number;
|
||||
};
|
||||
export type EchartsGraphFormData = QueryFormData &
|
||||
EchartsLegendFormData & {
|
||||
source: string;
|
||||
target: string;
|
||||
sourceCategory?: string;
|
||||
targetCategory?: string;
|
||||
colorScheme?: string;
|
||||
metric?: string;
|
||||
layout?: 'none' | 'circular' | 'force';
|
||||
roam: boolean | 'scale' | 'move';
|
||||
draggable: boolean;
|
||||
selectedMode?: boolean | 'multiple' | 'single';
|
||||
showSymbolThreshold: number;
|
||||
repulsion: number;
|
||||
gravity: number;
|
||||
baseNodeSize: number;
|
||||
baseEdgeWidth: number;
|
||||
edgeLength: number;
|
||||
edgeSymbol: string;
|
||||
friction: number;
|
||||
};
|
||||
|
||||
export type EChartGraphNode = Omit<GraphNodeItemOption, 'value'> & {
|
||||
value: number;
|
||||
tooltip?: Pick<SeriesTooltipOption, 'formatter'>;
|
||||
};
|
||||
|
||||
// @ts-ignore
|
||||
export const DEFAULT_FORM_DATA: EchartsGraphFormData = {
|
||||
...DEFAULT_LEGEND_FORM_DATA,
|
||||
source: '',
|
||||
|
||||
Reference in New Issue
Block a user