feat: support hide symbol of line chart
This commit is contained in:
parent
e095223705
commit
817fceff73
4 changed files with 12 additions and 4 deletions
|
|
@ -62,6 +62,8 @@ type ChartOption struct {
|
||||||
RadarIndicators []RadarIndicator
|
RadarIndicators []RadarIndicator
|
||||||
// The background color of chart
|
// The background color of chart
|
||||||
BackgroundColor Color
|
BackgroundColor Color
|
||||||
|
// The flag for show symbol of line, set this to *false will hide symbol
|
||||||
|
SymbolShow *bool
|
||||||
// The child charts
|
// The child charts
|
||||||
Children []ChartOption
|
Children []ChartOption
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -380,6 +380,7 @@ func Render(opt ChartOption, opts ...OptionFunc) (*Painter, error) {
|
||||||
Theme: opt.theme,
|
Theme: opt.theme,
|
||||||
Font: opt.font,
|
Font: opt.font,
|
||||||
XAxis: opt.XAxis,
|
XAxis: opt.XAxis,
|
||||||
|
SymbolShow: opt.SymbolShow,
|
||||||
}).render(renderResult, lineSeriesList)
|
}).render(renderResult, lineSeriesList)
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,7 @@ func main() {
|
||||||
Top: 5,
|
Top: 5,
|
||||||
Bottom: 10,
|
Bottom: 10,
|
||||||
}
|
}
|
||||||
|
opt.SymbolShow = charts.FalseFlag()
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,8 @@ type LineChartOption struct {
|
||||||
Title TitleOption
|
Title TitleOption
|
||||||
// The legend option
|
// The legend option
|
||||||
Legend LegendOption
|
Legend LegendOption
|
||||||
|
// The flag for show symbol of line, set this to *false will hide symbol
|
||||||
|
SymbolShow *bool
|
||||||
// background is filled
|
// background is filled
|
||||||
backgroundIsFilled bool
|
backgroundIsFilled bool
|
||||||
}
|
}
|
||||||
|
|
@ -123,7 +125,9 @@ func (l *lineChart) render(result *defaultRenderResult, seriesList SeriesList) (
|
||||||
}
|
}
|
||||||
drawingStyle.StrokeWidth = 1
|
drawingStyle.StrokeWidth = 1
|
||||||
seriesPainter.SetDrawingStyle(drawingStyle)
|
seriesPainter.SetDrawingStyle(drawingStyle)
|
||||||
|
if !isFalse(opt.SymbolShow) {
|
||||||
seriesPainter.Dots(points)
|
seriesPainter.Dots(points)
|
||||||
|
}
|
||||||
markPointPainter.Add(markPointRenderOption{
|
markPointPainter.Add(markPointRenderOption{
|
||||||
FillColor: seriesColor,
|
FillColor: seriesColor,
|
||||||
Font: opt.Font,
|
Font: opt.Font,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue