Adds the ability to draw an XY scatter plot. (#27)
* works more or less * updating comment * removing debugging printf * adding output * tweaks * missed a couple series validations * testing auto coloring * updated output.png * color tests etc. * sanity check tests. * should not use unkeyed fields anyway.
This commit is contained in:
parent
17b28beae8
commit
b713ff85cc
22 changed files with 511 additions and 72 deletions
5
chart.go
5
chart.go
|
|
@ -141,8 +141,10 @@ func (c Chart) Render(rp RendererProvider, w io.Writer) error {
|
|||
|
||||
func (c Chart) checkHasVisibleSeries() error {
|
||||
hasVisibleSeries := false
|
||||
var style Style
|
||||
for _, s := range c.Series {
|
||||
hasVisibleSeries = hasVisibleSeries || (s.GetStyle().IsZero() || s.GetStyle().Show)
|
||||
style = s.GetStyle()
|
||||
hasVisibleSeries = hasVisibleSeries || (style.IsZero() || style.Show)
|
||||
}
|
||||
if !hasVisibleSeries {
|
||||
return fmt.Errorf("must have (1) visible series; make sure if you set a style, you set .Show = true")
|
||||
|
|
@ -511,6 +513,7 @@ func (c Chart) styleDefaultsCanvas() Style {
|
|||
func (c Chart) styleDefaultsSeries(seriesIndex int) Style {
|
||||
strokeColor := GetDefaultColor(seriesIndex)
|
||||
return Style{
|
||||
DotColor: strokeColor,
|
||||
StrokeColor: strokeColor,
|
||||
StrokeWidth: DefaultSeriesLineWidth,
|
||||
Font: c.GetFont(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue