2
0
mirror of https://github.com/miguelmota/cointop synced 2024-11-05 00:00:14 +00:00

Save chart height after change.

This commit is contained in:
Simon Roberts 2021-09-30 07:43:09 +10:00
parent a85fb5ea50
commit 95a31d5488
No known key found for this signature in database
GPG Key ID: 0F30F99E6B771FD4
2 changed files with 9 additions and 1 deletions

View File

@ -342,6 +342,10 @@ func (ct *Cointop) ShortenChart() error {
ct.State.chartHeight = candidate
ct.State.lastChartHeight = ct.State.chartHeight
if err := ct.Save(); err != nil {
return err
}
go ct.UpdateChart()
return nil
}
@ -356,6 +360,10 @@ func (ct *Cointop) EnlargeChart() error {
ct.State.chartHeight = candidate
ct.State.lastChartHeight = ct.State.chartHeight
if err := ct.Save(); err != nil {
return err
}
go ct.UpdateChart()
return nil
}

View File

@ -304,7 +304,6 @@ func (ct *Cointop) ConfigToToml() ([]byte, error) {
chartMapIfc := map[string]interface{}{}
chartMapIfc["max_width"] = ct.State.maxChartWidth
chartMapIfc["height"] = ct.State.chartHeight
log.Debugf("XXX chart = %s", chartMapIfc)
var inputs = &ConfigFileConfig{
API: apiChoiceIfc,
@ -359,6 +358,7 @@ func (ct *Cointop) loadChartConfig() error {
chartHeightIfc, ok := ct.config.Chart["height"]
if ok {
ct.State.chartHeight = int(chartHeightIfc.(int64))
ct.State.lastChartHeight = ct.State.chartHeight
}
return nil
}