Skip to content

Commit

Permalink
Fixed review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
subhash-halder committed May 11, 2023
1 parent 4cbcfa0 commit b083ae1
Show file tree
Hide file tree
Showing 13 changed files with 434 additions and 246 deletions.
7 changes: 4 additions & 3 deletions demos/quadrantchart.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ <h1>Quadrant chart demos</h1>
</pre>

<pre class="mermaid">
%%{init: {"quadrantChart": {"xAxisPosition": "bottom", "chartWidth": 600, "chartHeight": 600} } }%%
%%{init: {"quadrantChart": {"chartWidth": 600, "chartHeight": 600} } }%%
quadrantChart
x-axis "Completeness of Vision ❤"
title Analytics and Business Intelligence Platforms
x-axis "Completeness of Vision ❤" -->
y-axis Ability to Execute
quadrant-1 Leaders
quadrant-2 Challengers
Expand All @@ -46,7 +47,7 @@ <h1>Quadrant chart demos</h1>
import mermaid from './mermaid.esm.mjs';
mermaid.initialize({
theme: 'default',
logLevel: 1,
logLevel: 3,
securityLevel: 'loose',
});
</script>
Expand Down
2 changes: 1 addition & 1 deletion docs/config/setup/modules/defaultConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#### Defined in

[defaultConfig.ts:2257](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/defaultConfig.ts#L2257)
[defaultConfig.ts:2293](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/defaultConfig.ts#L2293)

---

Expand Down
4 changes: 4 additions & 0 deletions packages/mermaid/src/config.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ export interface PieDiagramConfig extends BaseDiagramConfig {
export interface QuadrantChartConfig extends BaseDiagramConfig {
chartWidth: number;
chartHeight: number;
titleFontSize: number;
titlePadding: number;
quadrantPadding: number;
xAxisLabelPadding: number;
yAxisLabelPadding: number;
Expand All @@ -242,6 +244,8 @@ export interface QuadrantChartConfig extends BaseDiagramConfig {
pointRadius: number;
xAxisPosition: 'top' | 'bottom';
yAxisPosition: 'left' | 'right';
quadrantInternalBorderStrokeWidth: number;
quadrantExternalBorderStrokeWidth: number;
}

export interface ErDiagramConfig extends BaseDiagramConfig {
Expand Down
36 changes: 36 additions & 0 deletions packages/mermaid/src/defaultConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1326,6 +1326,24 @@ const config: Partial<MermaidConfig> = {
* Default value: 5
*/
yAxisLabelPadding: 5,
/**
* | Parameter | Description | Type | Required | Values |
* | ------------------ | ---------------------------------- | ------- | -------- | ------------------- |
* | titlePadding | Chart title top and bottom padding | number | Optional | Any positive number |
*
* **Notes:**
* Default value: 5
*/
titlePadding: 5,
/**
* | Parameter | Description | Type | Required | Values |
* | ------------------ | ---------------------------------- | ------- | -------- | ------------------- |
* | titleFontSize | Chart title font size | number | Optional | Any positive number |
*
* **Notes:**
* Default value: 20
*/
titleFontSize: 20,
/**
* | Parameter | Description | Type | Required | Values |
* | ------------------ | ---------------------------------- | ------- | -------- | ------------------- |
Expand Down Expand Up @@ -1407,6 +1425,24 @@ const config: Partial<MermaidConfig> = {
* Default value: left
*/
yAxisPosition: 'left',
/**
* | Parameter | Description | Type | Required | Values |
* | --------------------------------- | ------------------------------------------------------------- | ------- | -------- | ------------------- |
* | quadrantInternalBorderStrokeWidth | stroke width of edges of the box that are inside the quadrant | number | Optional | Any positive number |
*
* **Notes:**
* Default value: 1
*/
quadrantInternalBorderStrokeWidth: 1,
/**
* | Parameter | Description | Type | Required | Values |
* | --------------------------------- | -------------------------------------------------------------- | ------- | -------- | ------------------- |
* | quadrantExternalBorderStrokeWidth | stroke width of edges of the box that are outside the quadrant | number | Optional | Any positive number |
*
* **Notes:**
* Default value: 2
*/
quadrantExternalBorderStrokeWidth: 2,
/**
* | Parameter | Description | Type | Required | Values |
* | ----------- | ----------- | ------- | -------- | ----------- |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ accDescr\s*"{"\s* { this.begin("acc_descr_multiline");}

\s*"x-axis"\s* return 'X-AXIS';
\s*"y-axis"\s* return 'Y-AXIS';
\s*\-\-\>\s* return 'AXIS-TEXT-DELIMITER'
\s*\-\-+\>[^(\r?\n)\s]* return 'AXIS-TEXT-DELIMITER'
\s*"quadrant-1"\s* return 'QUADRANT_1';
\s*"quadrant-2"\s* return 'QUADRANT_2';
\s*"quadrant-3"\s* return 'QUADRANT_3';
Expand Down Expand Up @@ -118,12 +118,14 @@ statement
;

points
: text point_start point_x point_y {yy.addPoints($1, $3, $4);};
: text point_start point_x point_y {yy.addPoint($1, $3, $4);};

axisDetails
: X-AXIS text AXIS-TEXT-DELIMITER text {yy.setXAxisLeftText($2); yy.setXAxisRightText($4);}
| X-AXIS text AXIS-TEXT-DELIMITER {$2.text += $3; yy.setXAxisLeftText($2);}
| X-AXIS text {yy.setXAxisLeftText($2);}
| Y-AXIS text AXIS-TEXT-DELIMITER text {yy.setYAxisBottomText($2); yy.setYAxisTopText($4);}
| Y-AXIS text AXIS-TEXT-DELIMITER {$2.text += $3; yy.setYAxisBottomText($2);}
| Y-AXIS text {yy.setYAxisBottomText($2);}
;

Expand Down
Loading

0 comments on commit b083ae1

Please sign in to comment.