diff --git a/chart_option.go b/chart_option.go index cb3bd3f..71e9dfc 100644 --- a/chart_option.go +++ b/chart_option.go @@ -62,6 +62,8 @@ type ChartOption struct { RadarIndicators []RadarIndicator // The background color of chart BackgroundColor Color + // The flag for show symbol of line, set this to *false will hide symbol + SymbolShow *bool // The child charts Children []ChartOption } diff --git a/charts.go b/charts.go index 36bb17e..92a7e54 100644 --- a/charts.go +++ b/charts.go @@ -377,9 +377,10 @@ func Render(opt ChartOption, opts ...OptionFunc) (*Painter, error) { if len(lineSeriesList) != 0 { handler.Add(func() error { _, err := NewLineChart(p, LineChartOption{ - Theme: opt.theme, - Font: opt.font, - XAxis: opt.XAxis, + Theme: opt.theme, + Font: opt.font, + XAxis: opt.XAxis, + SymbolShow: opt.SymbolShow, }).render(renderResult, lineSeriesList) return err }) diff --git a/examples/line_chart/main.go b/examples/line_chart/main.go index a941bca..5edf65b 100644 --- a/examples/line_chart/main.go +++ b/examples/line_chart/main.go @@ -95,6 +95,7 @@ func main() { Top: 5, Bottom: 10, } + opt.SymbolShow = charts.FalseFlag() }, ) diff --git a/line_chart.go b/line_chart.go index 0770447..dee122f 100644 --- a/line_chart.go +++ b/line_chart.go @@ -60,6 +60,8 @@ type LineChartOption struct { Title TitleOption // The legend option Legend LegendOption + // The flag for show symbol of line, set this to *false will hide symbol + SymbolShow *bool // background is filled backgroundIsFilled bool } @@ -123,7 +125,9 @@ func (l *lineChart) render(result *defaultRenderResult, seriesList SeriesList) ( } drawingStyle.StrokeWidth = 1 seriesPainter.SetDrawingStyle(drawingStyle) - seriesPainter.Dots(points) + if !isFalse(opt.SymbolShow) { + seriesPainter.Dots(points) + } markPointPainter.Add(markPointRenderOption{ FillColor: seriesColor, Font: opt.Font,