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?
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.
Karputov Vladimir:
And why do I need scrolling, if you can create canvas to size chart?
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:
ChartShift.mq5
11 kb
dentedisega.JPG
90 kb
Instead of scrolling, I propose: track the movement of the mouse and redraw the canvas.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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