I recently started working with chart.js with react wrapper for a project. And when I was building this one chart which has a width of 20000px the bars stopped appearing on the screen after the 16390px length.
My chart was scrollable and I had a large dataset due to which the canvas have huge lengths. So I was confused if there is some length limit chart.js can draw its canvas upto.
Here is my code to replicate the issue with attached screenshots.
import React, { Component, createRef } from 'react'
import ChartJsComponent from "react-chartjs-2";
class ScrollableChartJsPlugin extends Component {
    chartRef = createRef()
    render(){ //this will simply return the chart
        return  <ChartJsComponent 
                    ref={this.chartRef}
                    {...this.props}
                />
    }
}
export default ScrollableChartJsPlugin;
import React, { Component } from 'react'
import ScrollableChart from "../../components/ScrollableChartJSPlugin";
class Observe extends Component {
    
    getRandomLabel = () => {
        let data = [];
        for(let i = 0; i<1000; i++){
            data.push(`Label ${i}`)
        }
        return data;
    }
    render(){ 
        var data =  {
            labels: this.getRandomLabel(),
            datasets: [
                {
                    backgroundColor: 'rgba(237, 77, 77,1)',
                    borderColor: 'rgba(237, 77, 77,1)',
                    borderWidth: 1,
                    hoverBackgroundColor: 'rgba(237, 77, 77,0.8)',
                    hoverBorderColor: 'rgba(237, 77, 77,1)',
                    data: this.getRandomLabel().map(el => 1000) //i am taking same value for all the bars as it'll be easier to catch when bars disappears
                }
            ]
        };
        var width = this.getRandomLabel().length * 50; //this will give each bar around 50px width and total width of the chart will go around 50000px
        return  <div style={{width: width}}>
                    <ScrollableChart
                        type={"bar"}
                        height={220}
                        width={width}
                        data={data}
                        getElementAtEvent={this.handleChartClick}
                        options={
                            {
                                maintainAspectRatio: false,
                                legend: {
                                    display: false
                                },
                                scales: {
                                    xAxes: [{
                                        gridLines: {
                                            display:false
                                        }
                                    }],
                                    yAxes: [{
                                        gridLines: {
                                            display:false
                                        }   
                                    }]
                                },
                                tooltips: {
                                    mode: 'index', 
                                    intersect: false
                                }
                            }
                        }
                    />
                </div>
    }
}
export default Observe;
screenshot produced by the result of the above code.
So, In case there is a max width limit in chart.js for drawable canvas, Can I get it work with any workaround or any fix that is applicable for this.
Thanks

