Usage

QuadrantChart allows the creation of Quadrant Charts.

Create an instance of QuadrantChart, add a title and the labels for the axes and quadrants, then add the points.

Axis Labels

Axis labels can be a string or array. If a string (or single element array) it is rendered as the left/bottom label for the x/y. If a two element array it is the left - right/bottom - top labels.

Points

Points have a label and their x and y values. Both x and y are 0 <= value <= 1.

Example

PHP

echo Mermaid::create(QuadrantChart::class)
    ->withTitle('Reach and engagement of campaigns')
    ->withAxes(['Low Reach', 'High Reach'], ['Low Engagement', 'High Engagement'])
    ->withQuadrants('We should expand', 'Need to promote', 'Re-evaluate', 'May be improved')
    ->withPoint(
        new Point('Campaign A', 0.3, 0.6),
        new Point('Campaign B', 0.45, 0.23),
        new Point('Campaign C', 0.57, 0.69),
        new Point('Campaign D', 0.78, 0.34),
        new Point('Campaign E', 0.4, 0.34),
        new Point('Campaign F', 0.35, 0.78)
    )
    ->render()
;

Generated Mermaid

<pre class="mermaid">
quadrantChart
  title Reach and engagement of campaigns
  x-axis Low Reach --> High Reach
  y-axis Low Engagement --> High Engagement
  quadrant-1 We should expand
  quadrant-2 Need to promote
  quadrant-3 Re-evaluate
  quadrant-4 May be improved
  Campaign A: [0.300000, 0.600000]
  Campaign B: [0.450000, 0.230000]
  Campaign C: [0.570000, 0.690000]
  Campaign D: [0.780000, 0.340000]
  Campaign E: [0.400000, 0.340000]
  Campaign F: [0.350000, 0.780000]
</pre>

Mermaid Diagram

        quadrantChart
  title Reach and engagement of campaigns
  x-axis Low Reach --> High Reach
  y-axis Low Engagement --> High Engagement
  quadrant-1 We should expand
  quadrant-2 Need to promote
  quadrant-3 Re-evaluate
  quadrant-4 May be improved
  Campaign A: [0.300000, 0.600000]
  Campaign B: [0.450000, 0.230000]
  Campaign C: [0.570000, 0.690000]
  Campaign D: [0.780000, 0.340000]
  Campaign E: [0.400000, 0.340000]
  Campaign F: [0.350000, 0.780000]