diff --git a/projects/ledge-render/package.json b/projects/ledge-render/package.json index d8fb7715..e9d049da 100644 --- a/projects/ledge-render/package.json +++ b/projects/ledge-render/package.json @@ -1,6 +1,6 @@ { "name": "@ledge-framework/render", - "version": "0.0.2", + "version": "0.0.3", "description": "Ledge Framework render, a powerful markdown render.", "license": "MPL-2.0", "repository": "https://github.com/phodal/ledge", diff --git a/projects/ledge-render/src/lib/chart/ledge-quadrant/ledge-quadrant.component.ts b/projects/ledge-render/src/lib/chart/ledge-quadrant/ledge-quadrant.component.ts index 7a2f424f..b330e10e 100644 --- a/projects/ledge-render/src/lib/chart/ledge-quadrant/ledge-quadrant.component.ts +++ b/projects/ledge-render/src/lib/chart/ledge-quadrant/ledge-quadrant.component.ts @@ -51,44 +51,40 @@ export class LedgeQuadrantComponent implements OnInit, AfterViewInit { ], }; - const {textValueKey, textValueKey} = this.buildGraphConfig(data, key, graphConfig); + const textValue = data.config[key]; + graphConfig.children[0].style.text = textValue; + switch (key) { + case 'left': + graphConfig.top = 'middle'; + graphConfig.left = 30; + graphConfig.children[0].style.text = ''; + for (const textValueKey of textValue) { + graphConfig.children[0].style.text += textValueKey + '\n'; + } + break; + case 'right': + graphConfig.top = 'middle'; + graphConfig.right = 30; + graphConfig.children[0].style.text = ''; + for (const textValueKey of textValue) { + graphConfig.children[0].style.text += textValueKey + '\n'; + } + break; + case 'bottom': + graphConfig.left = 'center'; + graphConfig.bottom = 30; + break; + case 'top': + graphConfig.left = 'center'; + graphConfig.top = 30; + break; + } + graphic.push(graphConfig); } } } - private buildGraphConfig(data, key: string, graphConfig: any) { - const textValue = data.config[key]; - graphConfig.children[0].style.text = textValue; - switch (key) { - case 'left': - graphConfig.top = 'middle'; - graphConfig.left = 30; - graphConfig.children[0].style.text = ''; - for (const textValueKey of textValue) { - graphConfig.children[0].style.text += textValueKey + '\n'; - } - break; - case 'right': - graphConfig.top = 'middle'; - graphConfig.right = 30; - graphConfig.children[0].style.text = ''; - for (const textValueKey of textValue) { - graphConfig.children[0].style.text += textValueKey + '\n'; - } - break; - case 'bottom': - graphConfig.left = 'center'; - graphConfig.bottom = 30; - break; - case 'top': - graphConfig.left = 'center'; - graphConfig.top = 30; - break; - } - return {textValueKey, textValueKey}; - } - buildOption(data) { if (!data.children) { return; @@ -115,7 +111,10 @@ export class LedgeQuadrantComponent implements OnInit, AfterViewInit { this.buildConfig(data, graphic); return { - title: {text: data.name, left: 'center',}, + title: { + text: data.name, + left: 'center', + }, graphic, series: [ { diff --git a/projects/ledge-render/src/lib/ledge-render.component.html b/projects/ledge-render/src/lib/ledge-render.component.html index 341c830f..cba4b976 100644 --- a/projects/ledge-render/src/lib/ledge-render.component.html +++ b/projects/ledge-render/src/lib/ledge-render.component.html @@ -100,12 +100,12 @@
-

-

-

-

-
-
+

+

+

+

+
+
diff --git a/projects/ledge-render/src/lib/ledge-render.component.ts b/projects/ledge-render/src/lib/ledge-render.component.ts index 2e8202c7..8249b7a6 100644 --- a/projects/ledge-render/src/lib/ledge-render.component.ts +++ b/projects/ledge-render/src/lib/ledge-render.component.ts @@ -284,7 +284,7 @@ export class LedgeRenderComponent implements OnInit, AfterViewInit, OnChanges { } } - private stringify(str: any) { + stringify(str: any) { return JSON.stringify(str); } }