PAD Charts
All charts/Bars

A survey, answer by answer

Horizontal and stacked: every answer a part of the bar.

1 The data bars/survey.php php
<?php

  // How 200 people answered five statements about their work.

  $survey = [
    [ 'statement' => 'I like my work',       'agree' => 128, 'neutral' => 44, 'disagree' => 28 ],
    [ 'statement' => 'I learn new things',   'agree' =>  96, 'neutral' => 62, 'disagree' => 42 ],
    [ 'statement' => 'My pay is fair',       'agree' =>  71, 'neutral' => 58, 'disagree' => 71 ],
    [ 'statement' => 'I have enough time',   'agree' =>  64, 'neutral' => 51, 'disagree' => 85 ],
    [ 'statement' => 'I would recommend us', 'agree' => 112, 'neutral' => 53, 'disagree' => 35 ]
  ];

?>
2 The chart tag bars/survey.pad pad
{chart 'hbar', data='survey', label='statement', value='agree, neutral, disagree', stacked, title='Answers per statement', width=640, height=340}
3 The result inline SVG · no JavaScript
Answers per statement I like my work: Agree 128, Neutral 44, Disagree 28; I learn new things: Agree 96, Neutral 62, Disagree 42; My pay is fair: Agree 71, Neutral 58, Disagree 71; I have enough time: Agree 64, Neutral 51, Disagree 85; I would recommend us: Agree 112, Neutral 53, Disagree 35 Agree Neutral Disagree 0 50 100 150 200 I like my work I learn new things My pay is fair I have enough time I would recommend us I like my work · Agree: 128 I like my work · Neutral: 44 I like my work · Disagree: 28 I learn new things · Agree: 96 I learn new things · Neutral: 62 I learn new things · Disagree: 42 My pay is fair · Agree: 71 My pay is fair · Neutral: 58 My pay is fair · Disagree: 71 I have enough time · Agree: 64 I have enough time · Neutral: 51 I have enough time · Disagree: 85 I would recommend us · Agree: 112 I would recommend us · Neutral: 53 I would recommend us · Disagree: 35