feat: support multi y axis

This commit is contained in:
vicanso 2021-12-18 09:49:44 +08:00
parent ead48fef8e
commit 23e2eca0c6
6 changed files with 62 additions and 61 deletions

View file

@ -58,6 +58,7 @@ type (
Title Title
Legend Legend
TickPosition chart.TickPosition
Log chart.Logger
}
)
@ -142,16 +143,20 @@ func New(opt Options) (Graph, error) {
}
}
var yAxisOption *YAxisOption
if len(opt.YAxisOptions) != 0 {
yAxisOption = opt.YAxisOptions[0]
}
var secondaryYAxisOption *YAxisOption
if len(opt.YAxisOptions) != 0 {
secondaryYAxisOption = opt.YAxisOptions[0]
}
yAxisOption := &YAxisOption{
Disabled: true,
}
if len(opt.YAxisOptions) > 1 {
secondaryYAxisOption = opt.YAxisOptions[1]
yAxisOption = opt.YAxisOptions[1]
}
g := &chart.Chart{
Log: opt.Log,
ColorPalette: &ThemeColorPalette{
Theme: opt.Theme,
},