3D Chart with vertical lines

TeeChart for ActiveX, COM and ASP
Post Reply
Fred9988
Newbie
Newbie
Posts: 4
Joined: Fri Nov 15, 2002 12:00 am

3D Chart with vertical lines

Post by Fred9988 » Tue Mar 15, 2016 11:23 am

Hi,

I am trying to achieve what is shown in the attachment (3D Chart.png).
Following are the features of the attached chart I want:
1. 3D
2. Individual vertical lines
3. Lines have color-range applied (from the legend)

I tried and found that (My Chart.png):
1. 3D - It is achievable
2. Individual vertical lines - There is no such support in the chart. There is "Point 3D", but the lines are connected. I want individual vertical lines.
3. Lines have color-range applied (from the legend) - When any type from "Point 3D" is selected, the lines do not show color-range from the legend. The lines are either a one solid color or a pre-defined gradient.

Can you please help me in this?
Looking forward to hear from you.

Thanks a lot!
Attachments
3D Chart.png
3D Chart sample
3D Chart.png (325.52 KiB) Viewed 9477 times
My Chart.png
My attempt for 3D chart
My Chart.png (296.88 KiB) Viewed 9463 times

Yeray
Site Admin
Site Admin
Posts: 9611
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: 3D Chart with vertical lines

Post by Yeray » Wed Mar 16, 2016 4:29 pm

Hello,

I'm afraid there isn't a series designed to draw such a chart.
However, you could try using one of the current series (ie a TBar3DSeries or a TLineSeries) and use it to get the desired result.

This is the best I could get for the moment with a TBar3DSeries:
testVerticalLines.png
testVerticalLines.png (168.13 KiB) Viewed 9433 times

Code: Select all

uses Bar3D, TeCanvas, Math, TeePNG;

var barRow: array of TBar3DSeries;
var myGradient: TTeeGradient;

procedure TForm1.FormCreate(Sender: TObject);
var i, j: Integer;
    tmpUp, tmpDown: Double;
begin
  Chart1.Legend.Visible:=false;
  Chart1.Aspect.Orthogonal:=false;
  Chart1.Chart3DPercent:=20;
  Chart1.Aspect.Zoom:=80;
  Chart1.Axes.Depth.Visible:=true;
  Chart1.Axes.Depth.LabelStyle:=talValue;
  Chart1.Axes.Depth.Increment:=2;
  Chart1.Axes.Left.SetMinMax(-20, -120);
  Chart1.Axes.Left.Increment:=20;
  Chart1.Axes.Bottom.SetMinMax(0, 10);
  Chart1.Axes.Bottom.Increment:=2;
  Chart1.Axes.Bottom.MinimumOffset:=10;
  Chart1.Axes.Bottom.MaximumOffset:=10;

  myGradient:=TTeeGradient.Create(nil);
  with myGradient do
  begin
    Visible:=true;
    Colors.Clear;
    Colors.Add(0, RGB(0, 0, 130));
    Colors.Add(0.2, RGB(0, 0, 255));
    Colors.Add(0.4, RGB(0, 255, 255));
    Colors.Add(0.6, RGB(255, 255, 0));
    Colors.Add(0.8, RGB(255, 0, 0));
    Colors.Add(1, RGB(130, 0, 0));
  end;

  SetLength(barRow, 10);
  for i:=0 to High(barRow) do
  begin
    barRow[i]:=Chart1.AddSeries(TBar3DSeries) as TBar3DSeries;

    with barRow[i] do
    begin
      Pen.Visible:=false;
      BarWidthPercent:=0;
      Depth:=0;
      Marks.Visible:=false;
      MultiBar:=mbNone;

      OnGetBarStyle:=BarGetBarStyle;

      for j:=0 to 19 do
      begin
        tmpUp:=-25-random(25);
        tmpDown:=-70-random(30);

        AddBar(j/2, tmpUp, tmpDown);
      end;
    end;
  end;
end;

procedure TForm1.BarGetBarStyle(Sender:TCustomBarSeries; ValueIndex:Integer;
                               var TheBarStyle:TBarStyle);
var tmpGradient: TTeeGradient;
begin
  tmpGradient:=myGradient;

  if Sender is TBarSeries then
    (Sender as TBarSeries).Gradient:=tmpGradient;
end;
Here is still pending to calculate the correct tmpGradient to assign at BarGetBarStyle. This should be calculated from myGradient manually.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply