added xml tag to img tag charts demo, cleaned up sparkline SVG

This commit is contained in:
Joshua Seigler 2016-07-03 02:50:18 -04:00
parent b04fc0416f
commit b5e3ecf479
2 changed files with 5 additions and 3 deletions

View file

@ -12,7 +12,6 @@ for ($n = 0, $current = $offset + 0.5 * $scale; $n < 24; $n++) {
$chartData[$n] = $current;
}
header('Content-type: image/svg+xml; charset=utf-8');
$chart = new NeatCharts\LineChart($chartData, [
'width'=>500,
'height'=>400,
@ -21,5 +20,8 @@ $chart = new NeatCharts\LineChart($chartData, [
'smoothed'=>false,
'fontSize'=>14
]);
header('Content-type: image/svg+xml; charset=utf-8');
echo '<?xml version="1.0" standalone="no"?>' . PHP_EOL;
echo $chart->render();
?>

View file

@ -175,7 +175,7 @@ namespace NeatCharts {
<stop offset="100%" stop-color="'.( $this->options['lineColor'] ).'" stop-opacity="1"></stop>
</linearGradient>
</defs>
<g class="SVGChart">
<g class="SVGChart">'.( $this->options['yAxisEnabled'] || $this->options['xAxisEnabled'] ? '
<g class="chart__gridLines"
shape-rendering="crispEdges"
fill="none"
@ -192,7 +192,7 @@ namespace NeatCharts {
font-size="'.( $this->options['fontSize'] ).'px"
>
'.( $gridText ).'
</g>
</g>' : '').'
<g class="chart__plotLine"
fill="none"
stroke-width="'.( $this->options['fontSize'] / 3 ).'"