Author Topic: parallel coordinates plot  (Read 359 times)


  • Full Member
  • ***
  • Posts: 198
parallel coordinates plot
« on: October 20, 2020, 05:37:17 pm »
Is it possible to draw parallel coordinates plot using TAchart?


  • Hero Member
  • *****
  • Posts: 7948
Re: parallel coordinates plot
« Reply #1 on: October 20, 2020, 07:35:02 pm »
Relatively easy when all vertical axes have the same scale - see attached demo:
  • For each coordinate add a vertical axis: right-click on the AxisList in the component tree of the object inspector (keep the original y axis as first dimension)
  • Use the Position property of each vertical axis to move it along the horizontal. So, when there are 6 dimensions, the axes are 20% apart. Set the Positions to 20, 40, 60, 80 and 100 for each of the new y axis (the original y axis can stay at Position 0. These numbers are interpreted as percentages because PosittionUnits is at cuPercent
  • To show the axes lines, set their AxisPen.Visible to false.
  • In order to get a decent x axis specify its limits. In the example of 6 dimensions set the Range.Max of the chart's BottomAxis to 5 and activate the limit by setting Range.UseMax to true. Set also Range.UseMin to true to force the lower limit to 0 (which is the default of Range.Min). Now the 6 y axis will be at exactly  the integer x values 0, 1, 2, 3, 4, 5 - these numbers will be needed when adding data.
  • In order to get "nice" x axis labels you should add a TListChartSource to the form, write the axis labels in the DataPoints of the chart source. The X value must be 0, 1, ..., 5, the label text should go into column "Text"; the Y values can be anything (but not empty). Link the chart source to the source property of the Marks of the chart's BottomAxis. Set Marks.Style to smsLabel to show the labels instead of the numbers.
  • Each 6-dimensional data point will be a TLineSeries. Add the series at designtime or by code. At an appropriate place in your code call the series' AddXY method to add the coordinates: the first index is the x index of the vertical axis, the second index is the datapoint coordinate. Example: the 6-D point (5, 6, 2, 10, 0, -1) will require this code:
Code: Pascal  [Select][+][-]
  1.   Lineseries1.AddXY(0, 5);
  2.   LineSeries1.AddXY(1, 6);
  3.   LineSeries1.AddXY(2, 2);
  4.   LineSeries1.AddXY(3, 10);
  5.   LineSeries1.AddXY(4, 0);
  6.   LineSeries1.AddXY(5, -1);

I do not have a solution at the moment for the case seen in the wiki page where the vertical axes are allowed to have different scales. The problem is that it is not possible to apply different axis transformations to the individual points of a series.
« Last Edit: October 20, 2020, 07:37:03 pm by wp »
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...


  • Full Member
  • ***
  • Posts: 198
Re: parallel coordinates plot
« Reply #2 on: October 21, 2020, 12:29:11 pm »
Thank you very much for your prompt reply. I will have a look.


TinyPortal © 2005-2018