Page 1 of 1

How to make marks have sizes in absolute pixels?

Posted: Tue Mar 09, 2010 9:08 am
by 10555193
Hello,

I want to have marks that will always be readable even if you change the zoom in the chart. Is it possible to make marks have a minimum of pixels width and height?
If that is not possible would it be possible to have marks have a width to a percentage of the chart or some other absolute property?
I have also considered 3dtext tools that I position at the base of a tower in a tower3d series to show extra data. Is it a good idea, performance wise to add a lot of 3dtext tools (one for each tower) that show the data.
The idea is that the user can rotate freely through the chart to look at labels and towers.

Thanks in advance,
Michael.

Re: How to make marks have sizes in absolute pixels?

Posted: Tue Mar 09, 2010 2:12 pm
by narcis
Hi Michael,

You can try customizing your marks as in the 2 different examples you'll find on this thread.

Hope this helps!

Re: How to make marks have sizes in absolute pixels?

Posted: Wed Mar 10, 2010 2:50 pm
by 10555193
I have used most of the suggestions in the previous post but I have run into a problem with the positions of marks.
Below I have added a simple click event that uses a TChart named as Chart1 on the form. A OpenGL component is linked and active to the TChart.
How do I manage positions after I have added a point to the chart? The positions of the marks remain empty after adding a point and I have no idea how to add a position.

Code: Select all

procedure TFormSomething.btnAddSeriesClick(Sender: TObject);
const
  cSize = 10;
var
  l3DPoints: TPoint3DSeries;
  X: integer;
  Y: integer;
  Z: integer;
  lMarkPosition: TSeriesMarkPosition;
begin
  l3DPoints := TPoint3DSeries.Create( Self );

  for x := 0 to cSize-1 do
  begin
    for z := 0 to cSize-1 do
    begin
       l3DPoints.AddXYZ( x, 0.2, z-0.5 );
       l3DPoints.ValueMarkText[ l3DPoints.Count-1 ] := 'loc(' + intToStr( x ) + ',' + intToStr( z ) + ')';
       // Now  Marks.Positions.Count = 0 which makes it impossible to change the position of a mark
       lMarkPosition := l3DPoints.Marks.Positions.Position[ l3DPoints.Count-1 ];
       lMarkPosition.Custom := True;
       lMarkPosition.Width := lMarkPosition.Width*2;
    end;
  end;

  Chart1.ClearChart;

  Chart1.AddSeries( l3DPoints );
  l3DPoints.DrawBetweenPoints := False;
  l3DPoints.LinePen.Hide;
  l3DPoints.Marks.Visible := True;
  l3DPoints.Marks.Transparent := True;
  l3DPoints.Marks.Font.Size := 12;
  l3DPoints.Pointer.Hide;
end;

Re: How to make marks have sizes in absolute pixels?

Posted: Thu Mar 11, 2010 9:42 am
by yeray
Hi Michael,

The positions are empty until the chart will be drawn. I'd recommend you to force a chart draw after adding all your data and after that, loop your values to modify their positions if you want.

Code: Select all

  Chart1.Draw;
  for X:=0 to l3DPoints.Count-1 do
  begin
    lMarkPosition := l3DPoints.Marks.Positions.Position[ l3DPoints.Count-1 ];
    lMarkPosition.Custom := True;
    lMarkPosition.Width := lMarkPosition.Width*2;
  end;