Skip to content

Zooming out on logarithmic axis clears the chart #153

@RaitzeR

Description

@RaitzeR

If you try to zoom out on a logarithmic axis, the chart data will disappear. I think this is because it tries to get a negative value for the scale.
There is no problems with panning though. It correctly gets the new scale.

options: {
              scales: {
                  xAxes: [{
                      type: 'linear',
                      ticks: {
                          userCallback: function(tick) {
                              return timeConverter(tick, false);
                          },
                          autoSkip: false,
                          maxRotation: 20,
                          minRotation: 20
                      },
                      position: 'bottom'
                  }],
                  yAxes: [{
                      type: 'logarithmic',
                      ticks: {
                          userCallback: function(tick) {
                              var remain = tick / (Math.pow(10, Math.floor(Chart.helpers.log10(tick))));
                              if (remain === 1) {
                                  return sanitizeNumber(tick).toString();
                              }
                              return '';
                          },
                      },
                  }]
              },
              tooltips: {
                  callbacks: {
                      label: function(tooltipItem, chartData) {
                          return "Time: "+ timeConverter(tooltipItem.xLabel, true) +" - Price:"+ sanitizeNumber(tooltipItem.yLabel) +""
                      }
                  }
              },
              pan: {
                  enabled: true,
                  mode: 'xy',
              },
              zoom: {
                  enabled: true,
                  mode: 'xy',
              }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions