Hi,
I have successfully implemented a timeseries line chart using ngx-charts. The timeseries is plotted on the X-axis and the values on Y-axis. Now I have a requirement to change the Y-axis to logarithmic scale.
Any pointers would be appreciated.
Thanks
Merin
I also have the requirement to have logarithmic scale. @merinshaji were you able to find workaround for the time being?
Hi,
here's a demo how to implement log scale in line chart based on @chriszrc's comment https://github.com/swimlane/ngx-charts/pull/455#issuecomment-626800581
https://stackblitz.com/edit/swimlane-line-chart-log-scale
Math.log10 to series datayAxisTickFormatting with Math.pow functiontooltipTemplate and seriesTooltipTemplate templateRef using Math.pow functionAnyway, I submit pull request https://github.com/swimlane/ngx-charts/pull/1420 where yAxisTickFormatting is applied to tooltip values so you don't need to define tooltipTemplate and seriesTooltipTemplate.
IMO, if you define yAxis ticks as apples, pears, rates, pow, etc... you want that tootlip values are displayed as apples, pears, rates, pow, etc...
@heyteacher thanks a lot for the help. The code link helped me understand where exactly to make the changes hence made changes in bar graph accordingly.
Most helpful comment
Hi,
here's a demo how to implement log scale in line chart based on @chriszrc's comment https://github.com/swimlane/ngx-charts/pull/455#issuecomment-626800581
https://stackblitz.com/edit/swimlane-line-chart-log-scale
Math.log10to series datayAxisTickFormattingwithMath.powfunctiontooltipTemplateandseriesTooltipTemplatetemplateRef usingMath.powfunctionAnyway, I submit pull request https://github.com/swimlane/ngx-charts/pull/1420 where
yAxisTickFormattingis applied to tooltip values so you don't need to definetooltipTemplateandseriesTooltipTemplate.IMO, if you define yAxis ticks as apples, pears, rates, pow, etc... you want that tootlip values are displayed as apples, pears, rates, pow, etc...