mirror of
https://github.com/seigler/neat-charts
synced 2025-07-27 01:16:09 +00:00
added a parameter for setting the marker color
This commit is contained in:
parent
2ca82f8258
commit
7701635a6c
3 changed files with 21 additions and 2 deletions
20
demo.php
20
demo.php
|
@ -51,6 +51,23 @@ $chart = new NeatCharts\LineChart(randomData(), [
|
||||||
'fontSize'=>14
|
'fontSize'=>14
|
||||||
]);
|
]);
|
||||||
echo $chart->render();
|
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>
|
<figcaption>Random generated data, loaded right in the page</figcaption>
|
||||||
</figure>
|
</figure>
|
||||||
|
@ -63,8 +80,9 @@ $chart = new NeatCharts\LineChart(randomData(48), [
|
||||||
'width'=>100,
|
'width'=>100,
|
||||||
'height'=>20,
|
'height'=>20,
|
||||||
'lineColor'=>'#000',
|
'lineColor'=>'#000',
|
||||||
|
'markerColor'=>'#F00',
|
||||||
'smoothed'=>false,
|
'smoothed'=>false,
|
||||||
'fontSize'=>2,
|
'fontSize'=>4,
|
||||||
'yAxisEnabled'=>false,
|
'yAxisEnabled'=>false,
|
||||||
'xAxisEnabled'=>false
|
'xAxisEnabled'=>false
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -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">
|
$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>
|
<defs>
|
||||||
<marker id="SVGChart-markerCircle-'.( $chartID ).'" markerWidth="2" markerHeight="2" refX="1" refY="1" markerUnits="strokeWidth">
|
<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>
|
</marker>
|
||||||
<linearGradient id="SVGChart-fadeFromNothing-'.( $chartID ).'" x1="0%" y1="0%" x2="100%" y2="0%">
|
<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>
|
<stop offset="0.5%" stop-color="'.( $this->options['lineColor'] ).'" stop-opacity="0"></stop>
|
||||||
|
|
|
@ -5,6 +5,7 @@ namespace NeatCharts {
|
||||||
'width' => 800,
|
'width' => 800,
|
||||||
'height' => 250,
|
'height' => 250,
|
||||||
'lineColor' => '#000',
|
'lineColor' => '#000',
|
||||||
|
'markerColor' => '#000',
|
||||||
'labelColor' => '#000',
|
'labelColor' => '#000',
|
||||||
'smoothed' => false,
|
'smoothed' => false,
|
||||||
'fontSize' => 15,
|
'fontSize' => 15,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue