adjusting candlestick style a bit

This commit is contained in:
Joshua Seigler 2016-07-11 00:53:54 -04:00
parent 6fa356305d
commit 0a9b7ee6a1

View file

@ -6,7 +6,7 @@ namespace NeatCharts {
'width' => 1200, 'width' => 1200,
'height' => 300, 'height' => 300,
'barColor' => '#000', 'barColor' => '#000',
'risingColor' => '#0D0', 'risingColor' => '#0B0',
'fallingColor' => '#D00', 'fallingColor' => '#D00',
'markerColor' => '#000', 'markerColor' => '#000',
'labelColor' => '#000', 'labelColor' => '#000',
@ -61,10 +61,12 @@ namespace NeatCharts {
$whiskerY1 = $this->transformY($v->high); $whiskerY1 = $this->transformY($v->high);
if ($v->close > $v->open) { if ($v->close > $v->open) {
$whiskerPoints .= ' M'.($barX).','.($whiskerY0).' '.($barX).','.($whiskerY1); $whiskerPoints .= ' M'.($barX).','.($whiskerY0).' '.($barX).','.($whiskerY1);
$risingPoints .= ' M'.($barX - $barRadius).','.$barY0.' '.($barX + $barRadius).','.$barY0.' '.($barX + $barRadius).','.$barY1.' '.($barX - $barRadius).','.$barY1.' Z'; // $risingPoints .= ' M'.($barX - $barRadius).','.$barY0.' '.($barX + $barRadius).','.$barY0.' '.($barX + $barRadius).','.$barY1.' '.($barX - $barRadius).','.$barY1.' Z';
$risingPoints .= ' M'.$barX.','.$barY0.' '.$barX.','.$barY1;
} else { } else {
$whiskerPoints .= ' M'.($barX).','.($whiskerY1).' '.($barX).','.($whiskerY0); $whiskerPoints .= ' M'.($barX).','.($whiskerY1).' '.($barX).','.($whiskerY0);
$fallingPoints .= ' M'.($barX - $barRadius).','.$barY0.' '.($barX + $barRadius).','.$barY0.' '.($barX + $barRadius).','.$barY1.' '.($barX - $barRadius).','.$barY1.' Z'; // $fallingPoints .= ' M'.($barX - $barRadius).','.$barY0.' '.($barX + $barRadius).','.$barY0.' '.($barX + $barRadius).','.$barY1.' '.($barX - $barRadius).','.$barY1.' Z';
$fallingPoints .= ' M'.$barX.','.$barY0.' '.$barX.','.$barY1;
} }
} }
@ -75,24 +77,26 @@ namespace NeatCharts {
class="chart__bars" class="chart__bars"
stroke="'.( $this->options['barColor'] ).'" stroke="'.( $this->options['barColor'] ).'"
stroke-width="1" stroke-width="1"
stroke-linecap="square" stroke-linecap="butt"
> >
<g <g
class="chart__whiskers" class="chart__whiskers"
stroke-width="1" stroke-width="'.( $barRadius ).'"
stroke-linecap="butt" stroke-opacity="0.25"
> >
<path d="'.( $whiskerPoints ).'" /> <path d="'.( $whiskerPoints ).'" />
</g> </g>
<g <g
class="chart__rising-bars" class="chart__rising-bars"
fill="'.( $this->options['risingColor'] ).'" stroke="'.( $this->options['risingColor'] ).'"
stroke-width="'.( $barRadius * 2 ).'"
> >
<path d="'.( $risingPoints ).'" /> <path d="'.( $risingPoints ).'" />
</g> </g>
<g <g
class="chart__falling-bars" class="chart__falling-bars"
fill="'.( $this->options['fallingColor'] ).'" stroke="'.( $this->options['fallingColor'] ).'"
stroke-width="'.( $barRadius * 2 ).'"
> >
<path d="'.( $fallingPoints ).'" /> <path d="'.( $fallingPoints ).'" />
</g> </g>