collab/mermaid/docs/syntax/quadrantChart.mdblame
View source
6dd74de1> **Warning**
6dd74de2>
6dd74de3> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
6dd74de4>
6dd74de5> ## Please edit the corresponding file in [/packages/mermaid/src/docs/syntax/quadrantChart.md](../../packages/mermaid/src/docs/syntax/quadrantChart.md).
6dd74de6
6dd74de7# Quadrant Chart
6dd74de8
6dd74de9> A quadrant chart is a visual representation of data that is divided into four quadrants. It is used to plot data points on a two-dimensional grid, with one variable represented on the x-axis and another variable represented on the y-axis. The quadrants are determined by dividing the chart into four equal parts based on a set of criteria that is specific to the data being analyzed. Quadrant charts are often used to identify patterns and trends in data, and to prioritize actions based on the position of data points within the chart. They are commonly used in business, marketing, and risk management, among other fields.
6dd74de10
6dd74de11## Example
6dd74de12
6dd74de13```mermaid-example
6dd74de14quadrantChart
6dd74de15 title Reach and engagement of campaigns
6dd74de16 x-axis Low Reach --> High Reach
6dd74de17 y-axis Low Engagement --> High Engagement
6dd74de18 quadrant-1 We should expand
6dd74de19 quadrant-2 Need to promote
6dd74de20 quadrant-3 Re-evaluate
6dd74de21 quadrant-4 May be improved
6dd74de22 Campaign A: [0.3, 0.6]
6dd74de23 Campaign B: [0.45, 0.23]
6dd74de24 Campaign C: [0.57, 0.69]
6dd74de25 Campaign D: [0.78, 0.34]
6dd74de26 Campaign E: [0.40, 0.34]
6dd74de27 Campaign F: [0.35, 0.78]
6dd74de28```
6dd74de29
6dd74de30```mermaid
6dd74de31quadrantChart
6dd74de32 title Reach and engagement of campaigns
6dd74de33 x-axis Low Reach --> High Reach
6dd74de34 y-axis Low Engagement --> High Engagement
6dd74de35 quadrant-1 We should expand
6dd74de36 quadrant-2 Need to promote
6dd74de37 quadrant-3 Re-evaluate
6dd74de38 quadrant-4 May be improved
6dd74de39 Campaign A: [0.3, 0.6]
6dd74de40 Campaign B: [0.45, 0.23]
6dd74de41 Campaign C: [0.57, 0.69]
6dd74de42 Campaign D: [0.78, 0.34]
6dd74de43 Campaign E: [0.40, 0.34]
6dd74de44 Campaign F: [0.35, 0.78]
6dd74de45```
6dd74de46
6dd74de47## Syntax
6dd74de48
6dd74de49> **Note**
6dd74de50> If there are no points available in the chart both **axis** text and **quadrant** will be rendered in the center of the respective quadrant.
6dd74de51> If there are points **x-axis** labels will rendered from the left of the respective quadrant also they will be displayed at the bottom of the chart, and **y-axis** labels will be rendered at the bottom of the respective quadrant, the quadrant text will render at the top of the respective quadrant.
6dd74de52
6dd74de53> **Note**
6dd74de54> For points x and y value min value is 0 and max value is 1.
6dd74de55
6dd74de56### Title
6dd74de57
6dd74de58The title is a short description of the chart and it will always render on top of the chart.
6dd74de59
6dd74de60#### Example
6dd74de61
6dd74de62```
6dd74de63quadrantChart
6dd74de64 title This is a sample example
6dd74de65```
6dd74de66
6dd74de67### x-axis
6dd74de68
6dd74de69The x-axis determines what text would be displayed in the x-axis. In x-axis there is two part **left** and **right** you can pass **both** or you can pass only **left**. The statement should start with `x-axis` then the `left axis text` followed by the delimiter `-->` then `right axis text`.
6dd74de70
6dd74de71#### Example
6dd74de72
6dd74de731. `x-axis <text> --> <text>` both the left and right axis text will be rendered.
6dd74de742. `x-axis <text>` only the left axis text will be rendered.
6dd74de75
6dd74de76### y-axis
6dd74de77
6dd74de78The y-axis determines what text would be displayed in the y-axis. In y-axis there is two part **top** and **bottom** you can pass **both** or you can pass only **bottom**. The statement should start with `y-axis` then the `bottom axis text` followed by the delimiter `-->` then `top axis text`.
6dd74de79
6dd74de80#### Example
6dd74de81
6dd74de821. `y-axis <text> --> <text>` both the bottom and top axis text will be rendered.
6dd74de832. `y-axis <text>` only the bottom axis text will be rendered.
6dd74de84
6dd74de85### Quadrants text
6dd74de86
6dd74de87The `quadrant-[1,2,3,4]` determine what text would be displayed inside the quadrants.
6dd74de88
6dd74de89#### Example
6dd74de90
6dd74de911. `quadrant-1 <text>` determine what text will be rendered inside the top right quadrant.
6dd74de922. `quadrant-2 <text>` determine what text will be rendered inside the top left quadrant.
6dd74de933. `quadrant-3 <text>` determine what text will be rendered inside the bottom left quadrant.
6dd74de944. `quadrant-4 <text>` determine what text will be rendered inside the bottom right quadrant.
6dd74de95
6dd74de96### Points
6dd74de97
6dd74de98Points are used to plot a circle inside the quadrantChart. The syntax is `<text>: [x, y]` here x and y value is in the range 0 - 1.
6dd74de99
6dd74de100#### Example
6dd74de101
6dd74de1021. `Point 1: [0.75, 0.80]` here the Point 1 will be drawn in the top right quadrant.
6dd74de1032. `Point 2: [0.35, 0.24]` here the Point 2 will be drawn in the bottom left quadrant.
6dd74de104
6dd74de105## Chart Configurations
6dd74de106
6dd74de107| Parameter | Description | Default value |
6dd74de108| --------------------------------- | -------------------------------------------------------------------------------------------------- | :-----------: |
6dd74de109| chartWidth | Width of the chart | 500 |
6dd74de110| chartHeight | Height of the chart | 500 |
6dd74de111| titlePadding | Top and Bottom padding of the title | 10 |
6dd74de112| titleFontSize | Title font size | 20 |
6dd74de113| quadrantPadding | Padding outside all the quadrants | 5 |
6dd74de114| quadrantTextTopPadding | Quadrant text top padding when text is drawn on top ( not data points are there) | 5 |
6dd74de115| quadrantLabelFontSize | Quadrant text font size | 16 |
6dd74de116| quadrantInternalBorderStrokeWidth | Border stroke width inside the quadrants | 1 |
6dd74de117| quadrantExternalBorderStrokeWidth | Quadrant external border stroke width | 2 |
6dd74de118| xAxisLabelPadding | Top and bottom padding of x-axis text | 5 |
6dd74de119| xAxisLabelFontSize | X-axis texts font size | 16 |
6dd74de120| xAxisPosition | Position of x-axis (top , bottom) if there are points the x-axis will always be rendered in bottom | 'top' |
6dd74de121| yAxisLabelPadding | Left and Right padding of y-axis text | 5 |
6dd74de122| yAxisLabelFontSize | Y-axis texts font size | 16 |
6dd74de123| yAxisPosition | Position of y-axis (left , right) | 'left' |
6dd74de124| pointTextPadding | Padding between point and the below text | 5 |
6dd74de125| pointLabelFontSize | Point text font size | 12 |
6dd74de126| pointRadius | Radius of the point to be drawn | 5 |
6dd74de127
6dd74de128## Chart Theme Variables
6dd74de129
6dd74de130| Parameter | Description |
6dd74de131| -------------------------------- | --------------------------------------- |
6dd74de132| quadrant1Fill | Fill color of the top right quadrant |
6dd74de133| quadrant2Fill | Fill color of the top left quadrant |
6dd74de134| quadrant3Fill | Fill color of the bottom left quadrant |
6dd74de135| quadrant4Fill | Fill color of the bottom right quadrant |
6dd74de136| quadrant1TextFill | Text color of the top right quadrant |
6dd74de137| quadrant2TextFill | Text color of the top left quadrant |
6dd74de138| quadrant3TextFill | Text color of the bottom left quadrant |
6dd74de139| quadrant4TextFill | Text color of the bottom right quadrant |
6dd74de140| quadrantPointFill | Points fill color |
6dd74de141| quadrantPointTextFill | Points text color |
6dd74de142| quadrantXAxisTextFill | X-axis text color |
6dd74de143| quadrantYAxisTextFill | Y-axis text color |
6dd74de144| quadrantInternalBorderStrokeFill | Quadrants inner border color |
6dd74de145| quadrantExternalBorderStrokeFill | Quadrants outer border color |
6dd74de146| quadrantTitleFill | Title color |
6dd74de147
6dd74de148## Example on config and theme
6dd74de149
6dd74de150```mermaid-example
6dd74de151---
6dd74de152config:
6dd74de153 quadrantChart:
6dd74de154 chartWidth: 400
6dd74de155 chartHeight: 400
6dd74de156 themeVariables:
6dd74de157 quadrant1TextFill: "ff0000"
6dd74de158---
6dd74de159quadrantChart
6dd74de160 x-axis Urgent --> Not Urgent
6dd74de161 y-axis Not Important --> "Important ❤"
6dd74de162 quadrant-1 Plan
6dd74de163 quadrant-2 Do
6dd74de164 quadrant-3 Delegate
6dd74de165 quadrant-4 Delete
6dd74de166```
6dd74de167
6dd74de168```mermaid
6dd74de169---
6dd74de170config:
6dd74de171 quadrantChart:
6dd74de172 chartWidth: 400
6dd74de173 chartHeight: 400
6dd74de174 themeVariables:
6dd74de175 quadrant1TextFill: "ff0000"
6dd74de176---
6dd74de177quadrantChart
6dd74de178 x-axis Urgent --> Not Urgent
6dd74de179 y-axis Not Important --> "Important ❤"
6dd74de180 quadrant-1 Plan
6dd74de181 quadrant-2 Do
6dd74de182 quadrant-3 Delegate
6dd74de183 quadrant-4 Delete
6dd74de184```
6dd74de185
6dd74de186### Point styling
6dd74de187
6dd74de188Points can either be styled directly or with defined shared classes
6dd74de189
6dd74de1901. Direct styling
6dd74de191
6dd74de192```md
6dd74de193Point A: [0.9, 0.0] radius: 12
6dd74de194Point B: [0.8, 0.1] color: #ff3300, radius: 10
6dd74de195Point C: [0.7, 0.2] radius: 25, color: #00ff33, stroke-color: #10f0f0
6dd74de196Point D: [0.6, 0.3] radius: 15, stroke-color: #00ff0f, stroke-width: 5px ,color: #ff33f0
6dd74de197```
6dd74de198
6dd74de1992. Classes styling
6dd74de200
6dd74de201```md
6dd74de202Point A:::class1: [0.9, 0.0]
6dd74de203Point B:::class2: [0.8, 0.1]
6dd74de204Point C:::class3: [0.7, 0.2]
6dd74de205Point D:::class3: [0.7, 0.2]
6dd74de206classDef class1 color: #109060
6dd74de207classDef class2 color: #908342, radius : 10, stroke-color: #310085, stroke-width: 10px
6dd74de208classDef class3 color: #f00fff, radius : 10
6dd74de209```
6dd74de210
6dd74de211#### Available styles:
6dd74de212
6dd74de213| Parameter | Description |
6dd74de214| ------------ | ---------------------------------------------------------------------- |
6dd74de215| color | Fill color of the point |
6dd74de216| radius | Radius of the point |
6dd74de217| stroke-width | Border width of the point |
6dd74de218| stroke-color | Border color of the point (useless when stroke-width is not specified) |
6dd74de219
6dd74de220> **Note**
6dd74de221> Order of preference:
6dd74de222>
6dd74de223> 1. Direct styles
6dd74de224> 2. Class styles
6dd74de225> 3. Theme styles
6dd74de226
6dd74de227## Example on styling
6dd74de228
6dd74de229```mermaid-example
6dd74de230quadrantChart
6dd74de231 title Reach and engagement of campaigns
6dd74de232 x-axis Low Reach --> High Reach
6dd74de233 y-axis Low Engagement --> High Engagement
6dd74de234 quadrant-1 We should expand
6dd74de235 quadrant-2 Need to promote
6dd74de236 quadrant-3 Re-evaluate
6dd74de237 quadrant-4 May be improved
6dd74de238 Campaign A: [0.9, 0.0] radius: 12
6dd74de239 Campaign B:::class1: [0.8, 0.1] color: #ff3300, radius: 10
6dd74de240 Campaign C: [0.7, 0.2] radius: 25, color: #00ff33, stroke-color: #10f0f0
6dd74de241 Campaign D: [0.6, 0.3] radius: 15, stroke-color: #00ff0f, stroke-width: 5px ,color: #ff33f0
6dd74de242 Campaign E:::class2: [0.5, 0.4]
6dd74de243 Campaign F:::class3: [0.4, 0.5] color: #0000ff
6dd74de244 classDef class1 color: #109060
6dd74de245 classDef class2 color: #908342, radius : 10, stroke-color: #310085, stroke-width: 10px
6dd74de246 classDef class3 color: #f00fff, radius : 10
6dd74de247```
6dd74de248
6dd74de249```mermaid
6dd74de250quadrantChart
6dd74de251 title Reach and engagement of campaigns
6dd74de252 x-axis Low Reach --> High Reach
6dd74de253 y-axis Low Engagement --> High Engagement
6dd74de254 quadrant-1 We should expand
6dd74de255 quadrant-2 Need to promote
6dd74de256 quadrant-3 Re-evaluate
6dd74de257 quadrant-4 May be improved
6dd74de258 Campaign A: [0.9, 0.0] radius: 12
6dd74de259 Campaign B:::class1: [0.8, 0.1] color: #ff3300, radius: 10
6dd74de260 Campaign C: [0.7, 0.2] radius: 25, color: #00ff33, stroke-color: #10f0f0
6dd74de261 Campaign D: [0.6, 0.3] radius: 15, stroke-color: #00ff0f, stroke-width: 5px ,color: #ff33f0
6dd74de262 Campaign E:::class2: [0.5, 0.4]
6dd74de263 Campaign F:::class3: [0.4, 0.5] color: #0000ff
6dd74de264 classDef class1 color: #109060
6dd74de265 classDef class2 color: #908342, radius : 10, stroke-color: #310085, stroke-width: 10px
6dd74de266 classDef class3 color: #f00fff, radius : 10
6dd74de267```