When developing indicators and Expert Advisors, we often need additional data output. This may be statistics, data from other timeframes, summary tables containing results, etc. In the simplest case, this problem is solved by creating a list of subsequently placed Label objects, but that may not be enough.
When developing such products, we commonly face the following issues:
- calculating the location of each object, as well as horizontal and vertical indents;
- modification issues, when a "table" or a "line" should be inserted, thus shifting all other labels;
- certain symbol stylization issues. For example, additional objects should be created for multi-colored arrows;
- inability to "stretch" or "compress" the location of objects. Each object should be modified to achieve this;
- complexity of creating full-fledged tables - additional objects are necessary for specifying a background, borders and indents.
In order to avoid the mentioned issues and focus on the product logic rather than graphical objects, we have developed an idea of a universal constructor suitable for solving all tasks related to creation of tables.
This constructor allows you:
- to avoid placing each cell separately - instead, you have to set data on each cell. Besides, you can easily access any part of the table;
- to scale the table easily - you only set the table's width and height, and the cells are expanded automatically afterwards. There is also an ability to set a width and height of each cell relative to their cells;
- to stylize the table easily setting the style of borders, background and text of each cell or group of cells. Styles can also be removed to justify a text;
- to create combined cells;
- to display a table in any corner of the window and in any window with no extra operations and calculations.
The main product principle is the ability of unlimited inclusions meaning that any area of a table can be both a cell and a table within the table. The depth of inclusions is unlimited - there may be a table within a table which in turn is also located within a table etc. Thus, you can create a table and insert another table to each of the cells. An inserted table can be accessed by name and processed in various ways. Suppose that we have created МАСD table. It can be added to the main table regardless of whether before and after filling. Next, we can work with МАСD area only: change the number of cells, change styles, data - the area is displayed correctly within the main table. We even do not have to calculate complex cell "coordinates" - we only need to know the name of the area when creating a complex table.
Each table or cell has a set of style parameters:
- size_x - horizontal size: for the main table, these are pixels, for the inserted tables, this is a relative size (by default, 10);
- size_y - vertical size: for the main table, these are pixels, for the inserted tables, this is a relative size (by default, 10);
- indent_x - horizontal indent (regardless of whether displayed or not) of a text in pixels;
- indent_y - vertical indent (regardless of whether displayed or not) of a text in pixels;
- text_color- text color;
- text_size - text size;
- text_font - font name for a test;
- border_color - border color;
- border_type - border type;
- border_width - border width;
- back_color - background color;
- back_clear - background (true) or foreground (false).