mirror of
				https://github.com/mermaid-js/mermaid.git
				synced 2025-11-04 12:54:08 +01:00 
			
		
		
		
	feat: Change precedence of styling
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
			
		||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
 | 
			
		||||
import { imgSnapshotTest } from '../../helpers/util.ts';
 | 
			
		||||
 | 
			
		||||
describe('Quadrant Chart', () => {
 | 
			
		||||
  it('should render if only chart type is provided', () => {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
import { scaleLinear } from 'd3';
 | 
			
		||||
import { log } from '../../logger.js';
 | 
			
		||||
import type { BaseDiagramConfig, QuadrantChartConfig } from '../../config.type.js';
 | 
			
		||||
import defaultConfig from '../../defaultConfig.js';
 | 
			
		||||
import { log } from '../../logger.js';
 | 
			
		||||
import { getThemeVariables } from '../../themes/theme-default.js';
 | 
			
		||||
import type { Point } from '../../types.js';
 | 
			
		||||
 | 
			
		||||
@@ -202,6 +202,7 @@ export class QuadrantBuilder {
 | 
			
		||||
    this.config = this.getDefaultConfig();
 | 
			
		||||
    this.themeConfig = this.getDefaultThemeConfig();
 | 
			
		||||
    this.data = this.getDefaultData();
 | 
			
		||||
    this.classes = {};
 | 
			
		||||
    log.info('clear called');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -486,19 +487,8 @@ export class QuadrantBuilder {
 | 
			
		||||
 | 
			
		||||
    const points: QuadrantPointType[] = this.data.points.map((point) => {
 | 
			
		||||
      const classStyles = this.classes[point.className as keyof typeof this.classes];
 | 
			
		||||
      if (classStyles !== undefined) {
 | 
			
		||||
        if (classStyles.color !== undefined) {
 | 
			
		||||
          point.color = classStyles.color;
 | 
			
		||||
        }
 | 
			
		||||
        if (classStyles.radius !== undefined) {
 | 
			
		||||
          point.radius = classStyles.radius;
 | 
			
		||||
        }
 | 
			
		||||
        if (classStyles.strokeColor !== undefined) {
 | 
			
		||||
          point.strokeColor = classStyles.strokeColor;
 | 
			
		||||
        }
 | 
			
		||||
        if (classStyles.strokeWidth !== undefined) {
 | 
			
		||||
          point.strokeWidth = classStyles.strokeWidth;
 | 
			
		||||
        }
 | 
			
		||||
      if (classStyles) {
 | 
			
		||||
        point = { ...classStyles, ...point };
 | 
			
		||||
      }
 | 
			
		||||
      const props: QuadrantPointType = {
 | 
			
		||||
        x: xAxis(point.x),
 | 
			
		||||
@@ -515,12 +505,8 @@ export class QuadrantBuilder {
 | 
			
		||||
          fontSize: this.config.pointLabelFontSize,
 | 
			
		||||
          rotation: 0,
 | 
			
		||||
        },
 | 
			
		||||
        strokeColor:
 | 
			
		||||
          point.strokeColor !== undefined && point.strokeColor !== ''
 | 
			
		||||
            ? point.strokeColor
 | 
			
		||||
            : this.themeConfig.quadrantPointFill,
 | 
			
		||||
        strokeWidth:
 | 
			
		||||
          point.strokeWidth !== undefined && point.strokeWidth !== '' ? point.strokeWidth : '0px',
 | 
			
		||||
        strokeColor: point.strokeColor || this.themeConfig.quadrantPointFill,
 | 
			
		||||
        strokeWidth: point.strokeWidth || '0px',
 | 
			
		||||
      };
 | 
			
		||||
      return props;
 | 
			
		||||
    });
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user