give Cristophe credit for js xCharts legend code