score:3
Accepted answer
you just need to modify the existing code mentioned in the fiddle with following code. this might help you work with v2.
animation: {
oncomplete: function(data) {
var getparentidname = this.chart.canvas.attributes.id.value,
targetelement = document.getelementbyid("virtual-chart-axis"),
sourceelement = document.getelementbyid("organizational-view"),
sourcecanvas = this.chart.ctx.canvas,
copywidth = this.scales["y-axis-0"].width, // we are copying the width of actual chart
copyheight = this.chart.height, // we are copying the width of actual chart
targetelementwidth = sourceelement.getcontext("2d").canvas.clientwidth,
targetelementheight = sourceelement.getcontext("2d").canvas.clientheight,
targetctx = targetelement.getcontext("2d");
targetctx.canvas.width = copywidth;
targetctx.canvas.height = copyheight;
targetctx.drawimage(sourcecanvas, 0, 0, targetelementwidth, targetelementheight);
}
}
good luck.
Source: stackoverflow.com
Related Query
- Chartjs 2 - Stacked bar and unstacked line on same chart with same y axis
- Chartjs 3.x - How to duplicate X axis on both sides of horizontal bar chart with only 1 dataset?
- Chart.js V2. bar chart with a fixed y-axis
- chart js - bar chart with time scale on Y axis in Hours and Minutes
- Chart.js bar chart with time on X axis and category on Y axis is not rendered
- ChartJS: Bar chart with axis ticks wider than categories
- ChartJS New Lines '\n' in X axis Labels or Displaying More Information Around Chart or Tooltip with ChartJS V2
- Horizontal stacked bar chart with chart.js
- Vertical stacked bar chart with chart.js
- Chart.js Mixed Bar and Line chart with different scales
- How do I draw a vertical line on a horizontal bar chart with ChartJS?
- How to display inline values in a stacked bar chart with Chart.js?
- Chart.js - Draw bar chart with multiple labels
- Show X axis on top and bottom in line chart rendered with Chart.js 2.4.0
- ChartJS bar chart with legend which corresponds to each bar
- Chart.js Dynamically Updating Chart with X Axis Time
- Obtain max value of y axis of line chart rendered with Chart.js
- Line chart with large number of labels on X axis
- angular-chart.js bar chart with 100% opacity color
- Chartjs - data format for bar chart with multi-level x-axes
- Fill Chart.js bar chart with diagonal stripes or other patterns
- How to hide the y axis and x axis line and label in my bar chart for chart.js
- Chart.js - Bar chart with linear cartesian (numerical) X axis?
- Chart.js with dual axis on bar and line graph
- Stacked horizontal bar chart along total count with chart.js
- ChartJS bar chart fixed width for dynamic data sets
- to increase space between x axis and first horizontal bar in chart js
- Stacked bar chart with rounded corner of bar using Chart.js
- Add buffer to Y axis with chart js
- Issue while plotting bar chart with custom x-axis with month and year in chart.js
More Query from same tag
- MongoDB based data is not populating in Chart.js
- How do I create a legend for a bar chart?
- Update data when pressing submit in chartjs in vuejs
- Exporting chart.js charts to svg using canvas2svg.js
- ChartJS Horizontal Bar is displaying backwards
- Update a chartjs by javascript function
- Draw points and lines inside a bar in bar chart
- ChartJS: unwanted top/bottom padding when legend is aligned right
- Chart.js, changing the max height (not w/ canvas) or rounding up rule?
- How can i loop some specific key in each index json data and put it in dataset: data ? (chart.js)
- How to bind json array data to chart.js with same canvas id?
- NPM module doesn't work with Webpack 3 but works with vue-cli3 which based on Webpack 4
- How to use a Data Array within a Chart JS dataset?
- Chart.js always visible labels
- why does my chart.js barograph order by whole numbers and then floats?
- Creating charts using chart.js
- Formatting Chart.js Chart
- setting chartjs global configuration using chartkick
- Unable to load Chart.js data from getJSON / PHP?
- How to create a gradient fill line chart in latest Chart JS version (3.3.2)?
- Why is my data on chartjs not starting from the data that it should
- How to add second Y-axis for Bar and Line chart in Chart.js?
- how to make Dashed and Solid Line Donut Chart.js
- Angular-chart copied from example not showing up
- Chart.js canvas cuts off doughnut stroke
- Is there any way I can customize my chartjs
- ChartJS in React throws 'too may re-renders'
- Cant To CHange Chart.js Legend
- Chart.js : how I can adjust Pie chart radius?
- Put the value into the doughnut chart