[SOLVED] TAChart first steps (3d, labels...) lazarus / 55-TAChart ---------------------------------------------------------------------- Raul_ES · 2020-06-15 11:56 Hi, I am giving my first steps with the TAChart, series, etc controls. I have been able (https://wiki.lazarus.freepascal.org/TAChart_documentation) to create different kind of charts and series. But I would need some help with the following: 1) How I switch from 2d to 3d view in a pie chart? This code does not work: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i // code to switch to 2d(...)Chart1PieSeries1.Depth:=0;Chart1PieSeries1.Orientatio n:=poNormal; // don't know how to do this :=pNormal? :=[pNormal]? Chart1PieSeries1.Orientation.poNormal? None works // poNormal is an enumerator type(...)// code to switch to 3dChart1PieSeries1.Depth:=15; Chart1PieSeries1.Orientation.poHorizontal; (...)  2) I know It is possible to label marks in an x axis with month names (i.e: to chart monthly expenses) but how?? I don't seem to find an example. I need to divide the x axis in 12 portions and label them. There's something I have missed to read somewhere. 3) It is possible to click one portion of a pie to slice it out? To create a kind of animation effect. regards, ---------------------------------------------------------------------- wp · 2020-06-15 13:04 (1) 3D in TAChart is kind of "fake", there is not "hidden line/hidden area" algorithm", and there are situation where it looks really wrong. But I spent a lot of time with the Pie series, and it looks almost always correct. The key parameter is, as you noticed, the Depth property, it defines the length if the in-depth lines connecting the font and back images of the series (in pixels) Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Toggle3D;begin  if PieSeries.Depth = 0 then PieSeries.Depth := 25 else PieSeries.Depth := 0;end; Using the "Orientation" requires Lazarus trunk, it is not yet contained in the current releases. It defines how the pies are oriented with respect to the viewer. poNormal has the circle upright like a wheel, poVertical, too, but the viewing direction is more oblique. in poHorizontal the wheel lies flat on the floor. (2) To label the x axis with strings you must assign a chartsource to the xaxis.Marks.Source and set xaxis.Marks.Style to smsLabel. For example, when you have 12 expense values (one each per month) you can add the data to the series like this (there are many other ways...): Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i series.AddXY(1, expenses_Jan, 'Jan');series.AddXY(2, expenses_Feb, 'Feb');...This way the data points are stored in the internal "ListSource of the series, and you added a text value to each data point. You can assign the series.ListSource to the xAxis.Marks.Source as noted to see the labels at runtime. Alternatively, you can add a separate TListChartSource to the form and put the month numbers and names in there. I added a demo to show this. (3) TPieSeries is a bit special. It normally has only Y values which, normalized to 360 degrees, are the opening angles of the pies. When X is 0 then the pies are centered. But when x of a pie is greater than 0 then the pie moves away from the center. Note however, that x is measured in units of the pie radius, i.e. when x is 0.1 (a good value) the pie would be offset by 1/10th of the radius. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i PieSeries.AddXY(0,   1000, 'Jan');PieSeries.AddXY(0,   1100, 'Feb');PieSeries.AddXY(0,    950, 'Mar');PieSeries.AddXY(0.1, 1200, 'April');   // <--- 0.1 --> Pie will be offset by 10% of the pie radiusPieSeries.AddXY(0,   1030, 'May');... There is a pie series demo in folder (lazarus)/components/tachart/demo/radial of your Lazarus installation. It demonstrates also how a pie can be offset by clicking with the mouse. ---------------------------------------------------------------------- Raul_ES · 2020-06-15 22:47 Thank you very much wp, (3) and (2) have been solved. And thanks for your clear source code. Sometimes reading so much documentation online becomes disturbing and confusing. ---------------------------------------------------------------------- Raul_ES · 2020-06-15 22:55 I don't fully understand (1). I actually use CodeTyphon 7.0 and the TAChart component TPieseries I believe it really supports the Orientation property. Let me show you some images from the IDE, check the attachments please. Picking poNormal, poVertical and poHorizontal from the Object Inspector seems to work. Isn't supposed to then work also on run-time? Let me ask the question again: what would be the right pascal sentence to change Orentation property of the pie at run-time? thanks ---------------------------------------------------------------------- wp · 2020-06-16 09:59 In 2D mode there is only a single Orientation. In 3D mode you set Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Chart1PieSeries1.Depth:=20;Chart1PieSeries1.Orientation:=poNormal;  // or poVertical or poHorizontal, requires unit TARadialSeries In the attachement there is another demo, now for the PieSeries. ---------------------------------------------------------------------- Raul_ES · 2020-06-16 10:30 thanks wp, I missed putting the right unit (taradialseries) inside the uses paragraph. Now it works as expected. regards