Libraries: Easy Canvas - page 17

 
Nikolai Semko #:
Latest version 1.53

Nicholas, just downloaded the lib, will try it, very interesting and thanks! And in the ZIP in kodobase is still the old version 1.09!!!! Good thing I read the comments and downloaded directly. If I were you, I would definitely post about this outstanding bug in the MT5, mql5, mql5.com thread suggestions for improvement!

MT5, mql5, mql5.com предложения по улучшению. - Сделайте реалистичные предложения по улучшению платформы MT5, языка mql5 и сайта и услуг Mql5 Com.
MT5, mql5, mql5.com предложения по улучшению. - Сделайте реалистичные предложения по улучшению платформы MT5, языка mql5 и сайта и услуг Mql5 Com.
  • 2013.06.15
  • www.mql5.com
удерживая клавишу CTRL при перетаскивании точки привязки. Модифицировать OnChartEvent для обработки нажатия на кнопку. Всплывающее окно появляется автоматически после третьего символа или вы можете вызвать его с помощью CTRL SPACE
 
Alexey Volchanskiy #:

Nicholas, just downloaded the lib, will try it, very interesting and thanks! And in the ZIP in kodobase there is still an old version 1.09!!!! Good thing I read the comments and downloaded directly. If I were you, I would definitely post about this outstanding bug in the MT5, mql5, mql5.com thread suggestions for improvement!

Thanks Alexey!
I wrote already more than 4 years ago.

 
Nicholas, is it possible to use your library to draw dynamically changing "rectangles" bound to candles to replace the currently used objects of OBJ_RECTANGLE type. It is necessary to display the overlapping of rectangles (i.e. the presence of transparency) in a visually beautiful way.
Perhaps there is an example of such use?
 
Peter Vorobyev OBJ_RECTANGLE type objects. It is necessary to display the overlapping of rectangles (i.e. the presence of transparency) in a visually beautiful way.
Perhaps there is an example of such use?

Of course you can, but it depends on what case.
If there are not many rectangles (~<1000) and they don't need to be resized often, you can do with standard CCanvas. In this case, each rectangle is a separate canvas tied to price-time coordinates. It will be necessary to take care of "cleaning up after yourself", so that objects do not multiply uncontrollably.
If there are a lot of objects and they often change their properties, it will be easier to use this library.
In this case you create an array of structures - virtual rectangles with the necessary properties and display them on the visible chart at the occurrence of the event of change of the chart or at your event of change of any properties.
This is the most productive variant, and the object of kanvas (bitmap) here will be one, stretched on the whole screen. But in this variant there will be a slight lag of graphical objects from the chart during vertical and horizontal scrolling.


A suitable example, perhaps, can be taken from the same library Test_iCanvas.mq5. In this example, there is a semi-transparent rectangle with text bound to bars. If you want the semi-transparent rectangles to mix colours when overlapping, you will need a function for such a rectangle. If you need, I can help you to do it quickly, or you can do it yourself, using the function from iCanvas LineDA class, LineHorizontalA is better.

ZY no the example Test_iCanvas.mq5 is not very suitable, because I implemented everything there in a crooked way through a timer. I need to rewrite this example. It was a dumb solution that confused me.
Well, look at more examples here and here. But in these examples there is no binding to price-per-time. For that you need to use X and Y functions to translate price-time coordinates into XY coordinates.
 
thanks for the detailed answer.
are you planning to implement in your library an object - rectangle allowing to draw a rectangle (create/move/modify) with specified properties like a usual graphical object?
 
Peter Vorobyev draw a rectangle (create/move/modify) with specified properties like a usual graphical object?

It is not quite clear what you mean.

There are different functions for drawing rectangles. It's enough to create, move and modify.

Yes, you can create any object as a structure or a class in your third-party code, in which you can write a method of output to the screen using this class iCanvas or CCanvas, but there is no sense to make all possible variations of implementations inside the graphics library. Only primitives are important. I, of course, have my own extended function of this library. It is many times larger than this one, but nobody will understand it but me. I wrote it for myself.

 
Nikolai Semko #:

I'm not quite sure what you mean.

There are different functions for drawing rectangles. It is enough to create, move and modify.

Yes, you can create any object as a structure or a class in your third-party code, in which you can write a method of output to the screen using this class iCanvas or CCanvas, but there is no sense to make all possible variations of implementations inside the graphics library. Only primitives are important. I, of course, have my own extended function of this library. It is many times larger than this one, but nobody will understand it but me. I wrote it for myself.

Thanks, I understand. After I get acquainted with the library in more detail and if there is a specific question then I will ask.

 
Peter Vorobyev #:

Thank you, I understand. after I will get acquainted with the library in more detail and if there is a specific question then I will ask.

here is a suitable EA example for you:

#include <Canvas\iCanvas_CB.mqh> //https://www.mql5.com/en/code/22164

//+------------------------------------------------------------------+
int OnInit() {
   return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
void OnDeinit(const int reason) {}
//+------------------------------------------------------------------+
void OnTick() {
   Draw();
}
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam) {
   if (id == CHARTEVENT_CHART_CHANGE || id == CHARTEVENT_MOUSE_MOVE) Draw();
}
//+------------------------------------------------------------------+
void Draw() {
   static uint last = 0;         //
   uint cur = GetTickCount();    // Necessary for performance optimisation
   if (cur-last<25) return;      // Especially important for the tester
   last = cur;                   //
   if (Canvas.tester) ChartChanged();   // for correct operation in the tester.
   Canvas.Erase(0x00FFFFFF);   // such a mask is necessary for correct font output
   Canvas.CurentFont("Calibri Light", 16,16,0xFF000000);
   for (int shift = -1000; shift<=1000; shift+=50 ) {
      uint clr = (Canvas.Grad((shift+1000.0)/2000.0) & 0x00FFFFFF)|0x40000000;
      int bar = Round(Canvas.Bar(double(_MouseX+shift)));
      double price  = iHigh(_Symbol,PERIOD_CURRENT,bar);
      int x = int(Canvas.X(double(bar)));
      int y = (int)_Y(price);
      Canvas.FillRectangleA(x,y,x+150,y-60,clr);
      
      _CommXY(x+5,y-55,"high = "+DoubleToString(price,_Digits));
      _Comment("bar = "+(string)bar);
      _Comment("time = " + TimeToString(iTime(_Symbol,PERIOD_CURRENT,bar))); 
   }
   Canvas.Update();
}


iCanvas version 1.54 is required to work.

Files:
 
Nikolai Semko #:

iCanvas version 1.54 is required for operation

Nikolai Semko #:
Latest version 1.53

I am also interested.

 
Edgar Akhmadeev #:

I was wondering the same thing.

Already updated and attached in previous post