Canvas class scroll

 
Is it possible to fix canvas size to half of datas dimension and to set a scroll on the horizontal axis?

Here I attach a code which can set as input canva size. If canvas size is bigger than datas size no problem, othervise the chart doesn't display correctly. I'd like to have a scroll function to move data on canvas when datas size is bigger than canvas size. Is it possible? If yes is there any example?

Thanks in advance
Files:
 
You can immediately get the height and width of graphics: CHART_HEIGHT_IN_PIXELS and CHART_WIDTH_IN_PIXELS.
 
And one more thing: the Canvas you need to create only one time.
 
Ok, Thanks for suggestion, but I don't understand how to set the scroll. I found an example where they can scroll text on a canvas creating a OBJ_RECTANGLE_LABEL (Rectangle Label) (https://www.mql5.com/en/articles/751), but I'm not sure you can do the same with chart lines.
 
gioooooo:
Ok, Thanks for suggestion, but I don't understand how to set the scroll. I found an example where they can scroll text on a canvas creating a OBJ_RECTANGLE_LABEL (Rectangle Label) (https://www.mql5.com/en/articles/751), but I'm not sure you can do the same with chart lines.
And why do I need scrolling, if you can create canvas to size chart?
 
Karputov Vladimir:
And why do I need scrolling, if you can create canvas to size chart?

In the example I draw a sawtooth, but in the real case I need to draw the FFT spectrum of price datas.

I need scrolling because I want to draw a frequency spectrum that is bigger than canvas size.

However I solvet the problem using CChart instead of CCanvas.

Here what I mean (the code with CChart and the image of a scrolling sawtooth)

Files:
 
Instead of scrolling, I propose: track the movement of the mouse and redraw the canvas.
Reason: