added a parameter for setting the marker color

This commit is contained in:
Joshua Seigler 2016-07-03 03:44:10 -04:00
parent 2ca82f8258
commit 7701635a6c
3 changed files with 21 additions and 2 deletions

View file

@ -51,6 +51,23 @@ $chart = new NeatCharts\LineChart(randomData(), [
'fontSize'=>14
]);
echo $chart->render();
?>
<figcaption>Random generated data, loaded right in the page</figcaption>
</figure>
</section>
<section>
<h2>Smoothed SVG chart in <code>svg</code> tag</h2>
<figure>
<?php
$chart = new NeatCharts\LineChart(randomData(12), [
'width'=>300,
'height'=>300,
'lineColor'=>'#080',
'labelColor'=>'#222',
'smoothed'=>true,
'fontSize'=>14
]);
echo $chart->render();
?>
<figcaption>Random generated data, loaded right in the page</figcaption>
</figure>
@ -63,8 +80,9 @@ $chart = new NeatCharts\LineChart(randomData(48), [
'width'=>100,
'height'=>20,
'lineColor'=>'#000',
'markerColor'=>'#F00',
'smoothed'=>false,
'fontSize'=>2,
'fontSize'=>4,
'yAxisEnabled'=>false,
'xAxisEnabled'=>false
]);

View file

@ -167,7 +167,7 @@ namespace NeatCharts {
$this->output = '<svg viewBox="-'.( $this->padding['left'] ).' -'.( $this->padding['top'] ).' '.( $this->options['width'] ).' '.( $this->options['height'] ).'" width="'.( $this->options['width'] ).'" height="'.( $this->options['height'] ).'" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<marker id="SVGChart-markerCircle-'.( $chartID ).'" markerWidth="2" markerHeight="2" refX="1" refY="1" markerUnits="strokeWidth">
<circle cx="1" cy="1" r="1" style="stroke: none; fill:'.( $this->options['lineColor'] ).';" />
<circle cx="1" cy="1" r="1" style="stroke: none; fill:'.( $this->options['markerColor'] ).';" />
</marker>
<linearGradient id="SVGChart-fadeFromNothing-'.( $chartID ).'" x1="0%" y1="0%" x2="100%" y2="0%">
<stop offset="0.5%" stop-color="'.( $this->options['lineColor'] ).'" stop-opacity="0"></stop>

View file

@ -5,6 +5,7 @@ namespace NeatCharts {
'width' => 800,
'height' => 250,
'lineColor' => '#000',
'markerColor' => '#000',
'labelColor' => '#000',
'smoothed' => false,
'fontSize' => 15,