Recent

Author Topic: Combine N charts in one  (Read 4826 times)

Vittorio

  • New Member
  • *
  • Posts: 32
Combine N charts in one
« on: August 28, 2018, 02:16:34 pm »
Hi there!

The issue is merging 2-10 charts in the one continous graph (see attached). For expample, to display measurement data of one set of details by different operators.

Is there not complicated way to do this?

valdir.marcos

  • Hero Member
  • *****
  • Posts: 1106
Re: Combine N charts in one
« Reply #1 on: August 28, 2018, 04:07:55 pm »
Hi there!

The issue is merging 2-10 charts in the one continous graph (see attached). For expample, to display measurement data of one set of details by different operators.

Is there not complicated way to do this?
I do many statistical analyses and show that information in separated parts:
- a chart per operator in a time frame;
- a chart per group of operators in a time frame;
- a column chart showing a positive or negative result being one column per operator considering a time frame.

The first two charts are used for individual and group analysis to help improve productivity.
The last one is used to fire people…

wp

  • Hero Member
  • *****
  • Posts: 11832
Re: Combine N charts in one
« Reply #2 on: August 28, 2018, 04:15:53 pm »
When you know the idea it is easy. If not, well... it may be complicated.

The basic idea is that of paned charts and multiple axes which is explained in two turorials:
- http://wiki.lazarus.freepascal.org/TAChart_Tutorial:_Multiple_Panes_in_one_Chart
- http://wiki.lazarus.freepascal.org/TAChart_Tutorial:_Dual_y_axis,_Legend
(Sorry, I'm too lazy to repeat this here, just read the tutorials).

In the attached demo I tried to achieve your screenshot this way

Based on what you have read in the tutorial try to create the same by yourself. You will be a TAChart master afterwards!

If you give me more information I can also create a set of routines from which you can create a multi-pane chart:
- Will the individual charts always be arranged as a stripe, i.e. will only the x axis be split and the y axis be the same for all charts? Or will it always be required to split the y axis to create an n x m layout (n columns, m rows)?
- In the latter case you should also provide a sketch what it should look like.
- Will there be only one series in each pane, or several series?
« Last Edit: August 28, 2018, 04:19:31 pm by wp »

Vittorio

  • New Member
  • *
  • Posts: 32
Re: Combine N charts in one
« Reply #3 on: August 29, 2018, 10:48:53 am »
Thanks a lot, I'll try.

Vittorio

  • New Member
  • *
  • Posts: 32
Re: Combine N charts in one
« Reply #4 on: August 29, 2018, 02:22:43 pm »
You will be a TAChart master afterwards!
Yep, I'm starting to understand your saying. :) Especially during runtime creation of TLineSeries, TListChartSources and handling of them. But "beauty is pain" :)

wp

  • Hero Member
  • *****
  • Posts: 11832
Re: Combine N charts in one
« Reply #5 on: August 29, 2018, 03:19:42 pm »
Some time ago I began writing a "Runtime FAQ": http://wiki.lazarus.freepascal.org/TAChart_Runtime_FAQ. Still very thin, but may answer the question how to create a series at runtime.

Vittorio

  • New Member
  • *
  • Posts: 32
Re: Combine N charts in one
« Reply #6 on: August 30, 2018, 09:39:40 am »
Some time ago I began writing a "Runtime FAQ": http://wiki.lazarus.freepascal.org/TAChart_Runtime_FAQ. Still very thin, but may answer the question how to create a series at runtime.
You're doing a great job. The good idea (as you've done) is to point out the required units. Yesterday I lost a lot of time to find them (f.e. TAChartAxisUtils for setting up an axis alignment).

wp

  • Hero Member
  • *****
  • Posts: 11832
Re: Combine N charts in one
« Reply #7 on: August 30, 2018, 10:45:06 am »
Two tricks:

(1) When identifiers are not found then it is usually a situation like this:
Code: Pascal  [Select][+][-]
  1. Chart1.AxisList[2].Alignment := calRight;
Ctrl-click on "Alignment" and Lazarus will open the unit in which Alignment is defined, in this case TAChartAxis:
Code: Pascal  [Select][+][-]
  1.     property Alignment default calLeft;  
calLeft is another element of the enumeration you are looking for. So, Ctrl-Click on it again and Lazarus will open the unit in which calLeft is declared along with calRight - it is TAChartAxisUtils. (If you want to learn about the inner structure of some library this is way to go. Knowing how to navigate through the source code is superior to reading documentation (which is always outdated anyway).)

The disadvantage is that this method does not work if the unit with the identifier on which you do the first click is not in "uses". This is when you need the second trick.

(2) Install the package Cody. Trying to compile the program will fail because the identifier calRight is not found. In the message window there is a message "Identifier not found". Right-click on this message and select "Search identifier". After a short time, the IDE will tell you that it is in unit TAChartAxisUtils.

wp

  • Hero Member
  • *****
  • Posts: 11832
Re: Combine N charts in one
« Reply #8 on: August 30, 2018, 11:31:50 pm »
I added three more chapters to the Runtime FAQ:
- How to add an axis at runtime?
- How to add an axis transformation?
- Logarithmic axis
« Last Edit: August 31, 2018, 10:27:56 am by wp »

 

TinyPortal © 2005-2018