score:0
You can use an event handler to check/update the ticks of the xAxes, to achieve a similar effect:
$('#zoom_in').click(function(){
ticks = myChart.chart.options.scales.xAxes[0].ticks;
/* if x-axis is categorical, use the data.labels to determine current axis range, e.g.:
labels = myChart.chart.data.labels;
startTick = labels.indexOf(ticks.min);
endTick = labels.indexOf(ticks.max);
*/
// below assumes ticks.min and ticks.max are numeric
var diff = ticks.max - ticks.min;
var factor = 0.05;
var newMin = ticks.min + factor * diff;
var newMax = ticks.max - factor * diff;
ticks.min = newMin;
ticks.max = newMax;
myChart.update();
});
Source: stackoverflow.com
Related Query
- implement chartjs zoom with buttons
- Add zoom event handler to charts for chartjs with chartjs-plugin-zoom
- Chartjs with zoom plugin zooms too much with wheel just with single turn
- Chartjs not working with d3 from csv source
- Zoom chartjs with many X values
- Updating Chartjs to 2.5 with custom code
- How to implement doughnut ChartJS with CodeIgniter 3 and display data from database
- Custom Legend with ChartJS v2.0
- Chartjs random colors for each part of pie chart with data dynamically from database
- ChartJS New Lines '\n' in X axis Labels or Displaying More Information Around Chart or Tooltip with ChartJS V2
- ChartJS - Draw chart with label by month, data by day
- What's the most effective way to implement a radar plot with 50 points at arbitrary locations using chart.js
- Display line chart with connected dots using chartJS
- react-chartjs-2 with chartJs 3: Error "arc" is not a registered element
- Chartjs 2 - Stacked bar and unstacked line on same chart with same y axis
- Show bar with zero value in ChartJs v2
- Chartjs linechart with only one point - how to center
- How to fix chart Legends width-height with overflow scroll in ChartJS
- ChartJS - Donut charts with multiple rings
- Chartjs v2 xAxes label overlap with scaleLabel
- Updating chartJS with dynamic data
- ChartJS bar chart with legend which corresponds to each bar
- ChartJS with AngularJS - Canvas won't display anything
- Vuejs with ChartJS populate from API
- ChartJS - Line Chart with different size datasets
- Usage of ChartJS v3 with TypeScript and Webpack
- Chartjs - data format for bar chart with multi-level x-axes
- Draw two plots using chartjs over one another with transparency
- Is it possible to combine two Y axes into a single tooltip with ChartJS 2?
- ChartJS - Line chart issue with only 1 point
More Query from same tag
- How can i get the Chart JS Bar Graph Bar Label and Value on click?
- Chart js with ng-repeat
- Bar labels in Legend
- decrease bar spacing chartJS v2
- ChartJS - Change legend to toggle buttons
- How to create two x-axes label using chart.js
- chart.js aspect ratio not square
- Charts js - How to make gridlines dash and How to make the gridlines stop at each point
- ChartJS automatically scaled chart has undefined min and max
- How to create datasets dynamically for chart.js Line chart?
- What happened to generateLegend() in chartjs 3.0?
- ng2-Chart: can we show the tooltip data of pie chart on load?
- How i can refresh chart without refresh page?
- Chart JS Legend Styling
- chartjs output data in month week and day
- how get data from given string in javascript?
- How to make pie chart from array values?
- How to remove a vertical line from the canvas of react-chartjs-2?
- Chart.js stacked bar ordering depending on value
- How to add ChartJS code in Html2Pdf to view image
- How to add a dataset toggle to Chart.js?
- refs in reactjs Component empty
- SPFx ChartJS Web Part
- Charts js and laravel: Render chart after passing in json data
- How do I import Chart.js Helper Functions in Django?
- Chartjs Custom Legend with Time on Y-axis
- How to change the Chart.js legend rectangles to squares
- Chart.js hours scale show day switch
- My charts doesn't work after inserting X-axis
- How do you hide the title of a chart tooltip?