fix the chart size to prevent them from shrinking when hidden
minor refactoring