Page 1 of 1

3D Graphs

Posted: Tue Aug 06, 2013 6:28 pm
by 16666664
DesiredGraph.jpg
This is the output we want to achieve.
DesiredGraph.jpg (132.12 KiB) Viewed 7380 times
CurrentGraph.jpg
This is the graph currently being generated.
CurrentGraph.jpg (41.08 KiB) Viewed 7395 times
Hi.
I am using the 2013 version of the ActiveX object with Visual FoxPro.
I have successfully created the TeeChart object at runtime and been able to generate 3D graphs.
I wish to "tweak" the appearance of the generated graph at runtime by manipulating the properties of the TeeChart object.
I am able to browse the exposed properties, events, and methods of the TeeChart object, but there are a large number of properties, methods, etc.,
with not much in the way of documentation on what each property does or what the acceptable values are for each property.

I have several needs at present for graph manipulation. Any assistance regarding which TeeChart object properties to use at runtime to be able to manipulate the graph will be greatly appreciated!
1. I need to rotate the 3D Bar chart on its "Z" axis to achieve a "flatter" perspective.
2. I need to be able to control the depth of the generated 3D bars to make them appear "thinner" 3D-wise.
3. I need to be able to have a 3D-effect applied to the X-Axis and the Y-Axis to give additional 3D-looking perspective to the graph.
4. I need to be able to have the individual graph bars constructed/painted using a heavy black pen with a blue interior to each bar. We are currently able to build each bar using the blue color but now wish to add a heavy-pen black outline to each bar for clarity.
5. I wish to have the Y-axis of the graph depict the values displayed in thousands.

Re: 3D Graphs

Posted: Wed Aug 07, 2013 3:13 pm
by yeray
Hi,
PrinterGuy wrote:1. I need to rotate the 3D Bar chart on its "Z" axis to achieve a "flatter" perspective.
I guess you just want to change the Chart3DPercent property. Ie:

Code: Select all

TChart1.Aspect.Chart3DPercent = 5
PrinterGuy wrote:2. I need to be able to control the depth of the generated 3D bars to make them appear "thinner" 3D-wise.
I think point #1 above also answers this.
PrinterGuy wrote:3. I need to be able to have a 3D-effect applied to the X-Axis and the Y-Axis to give additional 3D-looking perspective to the graph.
I'm not sure about what are you exactly trying to achieve here. Let me suggest you to set Orthogonal to false and play with the Elevation and Rotation:

Code: Select all

  TChart1.AddSeries scBar
  TChart1.Series(0).FillSampleValues
  
  TChart1.Aspect.Orthogonal = False
  TChart1.Aspect.Chart3DPercent = 40
  TChart1.Aspect.Elevation = 340
  TChart1.Aspect.Rotation = 340
Of course, if you still find problems to achieve what you want, please don't hesitate to let us know.
PrinterGuy wrote:4. I need to be able to have the individual graph bars constructed/painted using a heavy black pen with a blue interior to each bar. We are currently able to build each bar using the blue color but now wish to add a heavy-pen black outline to each bar for clarity.
By default the Pen is visible. Anyway, in the code below I'm forcing it to be visible:

Code: Select all

  TChart1.Legend.Visible = False
  
  Dim i As Integer
  TChart1.AddSeries scBar
  With TChart1.Series(0)
    .XValues.DateTime = True
    .Color = vbBlue
    .Marks.Visible = False
    
    .Pen.Visible = True
    .Pen.Width = 3
    
    For i = 0 To 12
      .AddXY DateAdd("m", i, Today), 50 + Rnd * 50, "", vbBlue
    Next i
  End With
  
  TChart1.Axis.Left.Labels.Font.Size = 12
  TChart1.Axis.Bottom.Labels.Font.Size = 12
  TChart1.Axis.Bottom.Labels.DateTimeFormat = "mmm"
And this is what I'm getting:
test.png
test.png (15.76 KiB) Viewed 7350 times
PrinterGuy wrote:5. I wish to have the Y-axis of the graph depict the values displayed in thousands.
I'm not sure if you want to format the axis labels as follows (ie 90 will be shown as 0.090):

Code: Select all

TChart1.Axis.Left.Labels.ValueFormat = "0,000.##"
Or maybe you mean to manipulate the axis labels to draw a number that doesn't correspond to the value that position represents. In this case, you may want to use custom labels (ie showing 9000 where the axis value corresponds to 90):

Code: Select all

  TChart1.Axis.Left.Labels.Clear
  For i = 0 To 9
    TChart1.Axis.Left.Labels.Add i * 10, Str$(i * 1000)
  Next i