I am trying to make a 3D view of a deviated well trace (using east, north and elevation), with the eventual hope of being able to rotate it on screen. I have created a test program and attached an image of my results.
1. I would have expected TeeChart to read the first three (comma-separated) columns as X, Y, Z and ignore any other fields but it seems to read the last three before an alphanumeric field. Why is this not the case?
2. When I make points invisible, I obtain symbols on the legend, which do not correspond to the point symbols. Why is this?
3. To make a "sensible" 3D graph, I need to input the data in east, elevation, north order. The only option in the Legend is the second column (Elevation). Is it possible to set different field(s) in the legend?
4. Is it possible to show each 25th point, say, in the legend, as can be set for marks?
5. I have a white rectangle on the screen which disappears only if I turn the axes off. What is this rectangle and how do I remove it?
6. I can rotate the graph at design time in 3D options. How can I rotate it at run time (preferably by using the mouse).
7. How do I round the marks to say 1 decimal place (without affecting the data).
I apologise for the lengthy list of queries.
Regards Errol
I have a few queries:How to make a Point 3D graph
Re: How to make a Point 3D graph
Hello Errol,
Note the TPoint3DSeries has UseColorRange set to true by default. Setting it to false will make the legend to show an entry for each point in the series. With UseColorRange or UsePalette, the legend shows entries representing a palette, not the actual values in the series.
Alternatively, you could use the OnGetLegendText event as in this example:
Thanks in advance.
There are some properties you could set to specify the separator and the index of each field in the rows:IanF wrote:1. I would have expected TeeChart to read the first three (comma-separated) columns as X, Y, Z and ignore any other fields but it seems to read the last three before an alphanumeric field. Why is this not the case?
Code: Select all
With SeriesTextSource1 do
begin
FieldSeparator:=',';
Fields.Clear;
AddField('X',1);
AddField('Y',2);
AddField('Z',3);
end;
How are you making points invisible?IanF wrote:2. When I make points invisible, I obtain symbols on the legend, which do not correspond to the point symbols. Why is this?
Note the TPoint3DSeries has UseColorRange set to true by default. Setting it to false will make the legend to show an entry for each point in the series. With UseColorRange or UsePalette, the legend shows entries representing a palette, not the actual values in the series.
Check the different lts* possibilities available for the Legend.TextStyle property. Ie:IanF wrote:3. To make a "sensible" 3D graph, I need to input the data in east, elevation, north order. The only option in the Legend is the second column (Elevation). Is it possible to set different field(s) in the legend?
Code: Select all
Chart1.Legend.TextStyle:=ltsXValue;
Code: Select all
procedure TForm1.Chart1GetLegendText(Sender: TCustomAxisPanel;
LegendStyle: TLegendStyle; Index: Integer; var LegendText: string);
begin
if (Index>-1) and (Index<Series1.Count) then
LegendText:=FormatFloat('#,##0.##', Series1.ZValue[Index]);
end;
I'm afraid the legend doesn't support this level of customization. However, you could draw your own legend manually at the OnAfterDraw event. Ie:IanF wrote:4. Is it possible to show each 25th point, say, in the legend, as can be set for marks?
Code: Select all
const diff=25;
procedure TForm1.Chart1AfterDraw(Sender: TObject);
var i, maxWidth, tmpX, tmpY, tmpH: Integer;
legendItems: array of String;
const xoff = 4;
yoff = 2;
ypos = 10;
begin
SetLength(legendItems, (Series1.Count div diff)+1);
maxWidth:=0;
with Chart1.Canvas do
begin
AssignBrush(Chart1.Legend.Brush);
AssignVisiblePen(Chart1.Legend.Pen);
AssignFont(Chart1.Legend.Font);
end;
for i:=0 to High(legendItems) do
begin
legendItems[i]:=FormatFloat('#,##0.##', Series1.ZValue[i*diff]);;
maxWidth:=Max(maxWidth, Chart1.Canvas.TextWidth(legendItems[i]));
end;
tmpX:=Chart1.Width - maxWidth - 10;
with Chart1.Canvas do
begin
tmpH:=TextHeight(legendItems[0]);
Rectangle(tmpX - xoff, ypos, tmpX + maxWidth + xoff, tmpH * Length(legendItems) + ypos + yoff*2);
for i:=0 to High(legendItems) do
begin
TextOut(tmpX, 12 + tmpH*i, legendItems[i]);
end;
end;
end;
I'm not getting any strange rectangle. Could you please arrange a simple example project we can run as-is to reproduce the problem here?IanF wrote:5. I have a white rectangle on the screen which disappears only if I turn the axes off. What is this rectangle and how do I remove it?
Thanks in advance.
You can use the RotateTool:IanF wrote:6. I can rotate the graph at design time in 3D options. How can I rotate it at run time (preferably by using the mouse).
Code: Select all
uses TeeTools;
//...
ChartTool1:=Chart1.Tools.Add(TRotateTool) as TRotateTool;
You can change the series ValueFormat. Ie:IanF wrote:7. How do I round the marks to say 1 decimal place (without affecting the data).
Code: Select all
Series1.ValueFormat:='#,##0.#';
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: How to make a Point 3D graph
Hi Yeray
Thank you for your comprehensive answers to my queries. However, I still have some questions (see example project attached).
1. I would like to put labels on the Left Axis, Bottom Axis and Depth Right Axis. However, at present, labels display only on Depth Top Axis, or Depth Right Axis which also displays the white rectangle I mentioned in a previous post. Labels used to display on Left Axis and Bottom Axis but they now don't.
2. How do I use Measured Depth as Marks down the Well Trace?
3. Is there an easy way to keep Bottom Axis and Depth Right Axis titles parallel to the axis, rather than at a fixed angle?
I look forward to your comments
Best regards
Errol
Thank you for your comprehensive answers to my queries. However, I still have some questions (see example project attached).
1. I would like to put labels on the Left Axis, Bottom Axis and Depth Right Axis. However, at present, labels display only on Depth Top Axis, or Depth Right Axis which also displays the white rectangle I mentioned in a previous post. Labels used to display on Left Axis and Bottom Axis but they now don't.
2. How do I use Measured Depth as Marks down the Well Trace?
3. Is there an easy way to keep Bottom Axis and Depth Right Axis titles parallel to the axis, rather than at a fixed angle?
I look forward to your comments
Best regards
Errol
- Attachments
-
- Well_3D.zip
- (22.39 KiB) Downloaded 931 times
Re: How to make a Point 3D graph
Hi Yeray
Sorry attached the wrong example project (again). Here is the correct one.
Regards
Errol
Sorry attached the wrong example project (again). Here is the correct one.
Regards
Errol
- Attachments
-
- Well_3D.zip
- (84.7 KiB) Downloaded 958 times
Re: How to make a Point 3D graph
Hello,
If I remove those lines I see the labels.
I also found this line in dfm. Removing it, the shape disappears:
I see in the dfm you are setting the Items property for both Left and Bottom axes. Note this is done when you uncheck the "Automatic" checkbox in the "Chart\Axis\Items" tab in the editor.IanF wrote:1. I would like to put labels on the Left Axis, Bottom Axis and Depth Right Axis. However, at present, labels display only on Depth Top Axis, or Depth Right Axis which also displays the white rectangle I mentioned in a previous post. Labels used to display on Left Axis and Bottom Axis but they now don't.
If I remove those lines I see the labels.
I also found this line in dfm. Removing it, the shape disappears:
Code: Select all
DepthAxis.Shape.Visible = True
Using automatic labels I believe it gives the expected labels in the bottom axis. Is this what you want?IanF wrote:2. How do I use Measured Depth as Marks down the Well Trace?
I'm afraid not. You could try to calculate the angles that better fit your requirements at your TRotateTool OnRotate event.IanF wrote:3. Is there an easy way to keep Bottom Axis and Depth Right Axis titles parallel to the axis, rather than at a fixed angle?
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: How to make a Point 3D graph
Hi Yeray
Thanks for your help. However I still have some problems.
1. By importing the Measured Depth as Text in the Series DataSource option, I can present Measured Depth values as Marks (see attached image). However, numbers are now presented with 15 decimal places. Can you indicate how I could round these values before using as Marks. 2.
3. If the Title angle for the Depth Right axis is set to 0, it displays at 270. A workaround is to specify an angle of 1.
4. Also, the Depth Right title position is displayed too close to the axis and interferes with the axis labels. Is there any way to position the title?
5. I get a floating point overflow when I strongly zoom in. How should I prevent this from happening?
6. The 3D Chart option offers a 3D option for some points, which is not very effective. The cube displays as a thin slab, rather than a cube. Is there any way to customise the presentation of the points?.
I look forward to your comments.
Thanks and regards Errol
Thanks for your help. However I still have some problems.
1. By importing the Measured Depth as Text in the Series DataSource option, I can present Measured Depth values as Marks (see attached image). However, numbers are now presented with 15 decimal places. Can you indicate how I could round these values before using as Marks. 2.
How do I find the angle of an axis in a 3D chart at any point of the rotation?You could try to calculate the angles that better fit your requirements at your TRotateTool OnRotate event.
3. If the Title angle for the Depth Right axis is set to 0, it displays at 270. A workaround is to specify an angle of 1.
4. Also, the Depth Right title position is displayed too close to the axis and interferes with the axis labels. Is there any way to position the title?
5. I get a floating point overflow when I strongly zoom in. How should I prevent this from happening?
6. The 3D Chart option offers a 3D option for some points, which is not very effective. The cube displays as a thin slab, rather than a cube. Is there any way to customise the presentation of the points?.
I look forward to your comments.
Thanks and regards Errol
- Attachments
-
- Well_3D.zip
- (185.59 KiB) Downloaded 986 times
Re: How to make a Point 3D graph
Hello Errol,
I haven't been able to make the attached project to look as in your screenshot. The txt files may be wrong.
You could fix it by capturing the series OnGetMarkText, convert the mark strings to doubles and format them as you wish. Here I'm formatting them using the Series Valueformat:
I haven't been able to make the attached project to look as in your screenshot. The txt files may be wrong.
You are loading the Labels (text) from the column 1 of the Well_Devi_AT-203_Rel.txt file, and your series (Series1) has Marks.Style property set to smsLabelValue (Label Or Value) which means "show labels if present; otherwise show values". That's why it is drawing the strings you are loading from the first column of the file.IanF wrote:1. By importing the Measured Depth as Text in the Series DataSource option, I can present Measured Depth values as Marks (see attached image). However, numbers are now presented with 15 decimal places. Can you indicate how I could round these values before using as Marks.
You could fix it by capturing the series OnGetMarkText, convert the mark strings to doubles and format them as you wish. Here I'm formatting them using the Series Valueformat:
Code: Select all
procedure TForm2.Series1GetMarkText(Sender: TChartSeries; ValueIndex: Integer;
var MarkText: string);
var value: Double;
begin
value:=StrToFloat(MarkText);
MarkText:=FormatFloat(Sender.ValueFormat, value);
end;
There may be a better way, but you could calculate the start&end points for both axes and get the angle from them. Ie:IanF wrote:2.How do I find the angle of an axis in a 3D chart at any point of the rotation?You could try to calculate the angles that better fit your requirements at your TRotateTool OnRotate event.
Code: Select all
procedure Tform2.ChartTool1Rotate(Sender: TObject);
var aStart, aEnd: TPoint;
aStart2D, aEnd2D: TPoint3D;
aAngle: Double;
begin
aStart2D.x:=DBChart1.Axes.Bottom.IStartPos;
aStart2D.y:=DBChart1.ChartRect.Bottom;
aStart2D.z:=Round(DBChart1.Aspect.ZOffset);
aStart:=DBChart1.Canvas.Calculate3DPosition(aStart2D);
aEnd2D.x:=DBChart1.Axes.Bottom.IEndPos;
aEnd2D.y:=DBChart1.ChartRect.Bottom;
aEnd2D.z:=Round(DBChart1.Aspect.ZOffset);
aEnd:=DBChart1.Canvas.Calculate3DPosition(aEnd2D);
aAngle:=ArcTan2(aEnd.Y-aStart.Y, aEnd.X-aStart.X);
DBChart1.Axes.Bottom.Title.Angle:=360-Round(aAngle/TeePiStep);
aStart2D.x:=DBChart1.Axes.Depth.PosAxis;
aStart2D.y:=DBChart1.ChartRect.Bottom;
aStart2D.z:=DBChart1.Axes.Depth.IStartPos;
aStart:=DBChart1.Canvas.Calculate3DPosition(aStart2D);
aEnd2D.x:=DBChart1.Axes.Depth.PosAxis;
aEnd2D.y:=DBChart1.ChartRect.Bottom;
aEnd2D.z:=DBChart1.Axes.Depth.IEndPos;
aEnd:=DBChart1.Canvas.Calculate3DPosition(aEnd2D);
aAngle:=ArcTan2(aEnd.Y-aStart.Y, aEnd.X-aStart.X);
DBChart1.Axes.Depth.Title.Angle:=360-Round(aAngle/TeePiStep);
end;
I can't reproduce this one. If you still find problems here, please arrange a simple example project we can run as-is to reproduce the problem here.IanF wrote:3. If the Title angle for the Depth Right axis is set to 0, it displays at 270. A workaround is to specify an angle of 1.
I'm afraid the only way to control the margin between the axis title and the axes labels is to hide it and draw it manually at OnAfterDraw event:IanF wrote:4. Also, the Depth Right title position is displayed too close to the axis and interferes with the axis labels. Is there any way to position the title?
Code: Select all
procedure TForm2.FormShow(Sender: TObject);
//...
DBChart1.Axes.Depth.Title.Hide;
end;
procedure TForm2.DBChart1AfterDraw(Sender: TObject);
const off=20;
begin
DBChart1.Canvas.RotateLabel3D(DBChart1.Axes.Depth.PosAxis+off*2,
DBChart1.ChartRect.Bottom-Round(DBChart1.ChartHeight*DBChart1.Axes.Depth.ZPosition*0.01)+off,
(DBChart1.Width3D div 2) + off,
DBChart1.Axes.Depth.Title.Caption,DBChart1.Axes.Depth.Title.Angle,
DBChart1.Axes.Depth.Title.TextFormat=ttfHtml);
end;
You can impede the user to keep zooming forcing a limit at OnMouseWheelUp. Ie:IanF wrote:5. I get a floating point overflow when I strongly zoom in. How should I prevent this from happening?
Code: Select all
procedure TForm2.DBChart1MouseWheelUp(Sender: TObject; Shift: TShiftState;
MousePos: TPoint; var Handled: Boolean);
begin
if DBChart1.Aspect.Zoom > 300 then
DBChart1.Aspect.Zoom := 300;
end;
I'm not sure what exact option do you mean. Could you please precise?IanF wrote:6. The 3D Chart option offers a 3D option for some points, which is not very effective. The cube displays as a thin slab, rather than a cube. Is there any way to customise the presentation of the points?
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |