Add a line from bottom left to top right chartjs năm 2024

Hello, How can i make the line graph stick to the exact border of the canvas ? I 've made a line graph without scales and there are always a gap between the left and the bottom borders of the canvas and the beginning of the charts... I try to play with the responsive and the maintainAspectRatio options without success... here is my configuration .

Thx

new Chart(ctx, {
          // responsive: false,
          type: 'line',
          // maintainAspectRatio:false,
          data: {
            labels: labels,
            datasets: [{
              fill:true,
              backgroundColor: "
# 47afbd",
              data: data
            }]
          },
          options: {
            defaultFontSize:10,
            animation:{
              onProgress:function(){
                if(self.$('
# engagement-chart-wrap').hasClass('isLoading')){
                  self.$('
# engagement-chart-wrap').removeClass('isLoading');
                }
              }
            },
            legend: {
              display: false
            },
            tooltips:{
              enabled:false
            },
            elements:{
              point:{
                radius:0
              }
            },
            scales: {
              yAxes: [{
                ticks :{
                  display:false,
                  padding:0
                },
                gridLines:{
                  drawTicks:false,
                  drawBorder:false
                },
                scaleLabel:{
                  display:false
                }
              }],
              xAxes: [{
                ticks :{
                  display:false,
                  padding:0
                },
                gridLines:{
                  display:false,
                  drawTicks:false,
                  drawBorder:false
                }
              }]
            }
          }
        });

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Pick a username Email Address Password

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If this value is an object, the left property defines the left padding. Similarly, the right, top and bottom properties can also be specified. Omitted properties default to 0.

How do you add a vertical line in Chartjs?

A vertical line chart is a variation on the horizontal line chart. To achieve this, you will have to set the indexAxis property in the options object to 'y' . The default for this property is 'x' and thus will show horizontal lines.

Which type of chart connects data points with a continuous line?

The line chart, or line graph, connects several distinct data points, presenting them as one continuous evolution. Use line charts to view trends in data, usually over time (like stock price changes over five years or website page views for the month).

What is ticks in Chartjs?

In Chart. js, "ticks" are the incremental markings that label values along the axis of the chart. It is possible to write a custom function that determines how tick marks are displayed on the chart.

How do I add a line to a chart in Powerpoint?

Add predefined lines or bars to a chart On the Layout tab, in the Analysis group, do one of the following: Click Lines, and then click the line type that you want. Note: Different line types are available for different chart types. Click Up/Down Bars, and then click Up/Down Bars.