PieChart: very inaccurate value when clicking on slices

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
NoName
Newbie
Newbie
Posts: 34
Joined: Fri Nov 15, 2002 12:00 am
Location: Italy

PieChart: very inaccurate value when clicking on slices

Post by NoName » Mon Sep 19, 2005 1:19 pm

I am using TeeChart Pro v7.02 on Delphi 6.

I have a 3D PieChart: when I click on a slice, the event "OnClick", on certain conditions, gives me a wrong ValueIndex.

Here are the steps to reproduce this behaviour:

1) in Delphi, open a new form and paste the following code:

Code: Select all

      object Chart4: TChart
        Left = 396
        Top = 11
        Width = 421
        Height = 406
        BackWall.Gradient.EndColor = 11118482
        BackWall.Gradient.Visible = True
        BackWall.Transparent = False
        Border.Color = 14645801
        Border.Width = 7
        Border.Visible = True
        BottomWall.Gradient.EndColor = 16580349
        BottomWall.Gradient.StartColor = 3114493
        BottomWall.Gradient.Visible = True
        Gradient.Direction = gdDiagonalDown
        Gradient.EndColor = 11645361
        Gradient.Visible = True
        LeftWall.Gradient.EndColor = 2413052
        LeftWall.Gradient.StartColor = 900220
        LeftWall.Gradient.Visible = True
        Legend.Color = clInfoBk
        Legend.Gradient.Direction = gdTopBottom
        Legend.Gradient.EndColor = clYellow
        Legend.Gradient.StartColor = clWhite
        Legend.Gradient.Visible = True
        Legend.Shadow.Color = 13421772
        Legend.Shadow.Transparency = 50
        Legend.Symbol.Pen.Visible = False
        Legend.Visible = False
        MarginBottom = 1
        MarginLeft = 1
        MarginRight = 1
        MarginTop = 1
        Title.Color = clInfoBk
        Title.Font.Height = -13
        Title.Font.Style = [fsBold]
        Title.Frame.Color = clGray
        Title.Shadow.HorizSize = 0
        Title.Shadow.VertSize = 0
        Title.Text.Strings = (
          'Click on a slice')
        Chart3DPercent = 25
        Shadow.Color = clBlack
        Shadow.HorizSize = 10
        Shadow.VertSize = 10
        View3DOptions.Elevation = 315
        View3DOptions.Orthogonal = False
        View3DOptions.Perspective = 0
        View3DOptions.Rotation = 360
        BevelOuter = bvNone
        TabOrder = 0
        PrintMargins = (
          15
          2
          15
          2)
        ColorPaletteIndex = 9
        object Series5: TPieSeries
          Marks.Callout.Brush.Color = clBlack
          Marks.Frame.Color = clGray
          Marks.Gradient.Visible = True
          Marks.Shadow.Color = 13421772
          Marks.Shadow.HorizSize = 2
          Marks.Shadow.VertSize = 2
          Marks.Visible = True
          OnClick = Series5Click
          Gradient.Direction = gdRadial
          OtherSlice.Legend.Visible = False
          OtherSlice.Text = 'Altro'
          PiePen.Visible = False
          PieValues.Name = 'Torta'
          PieValues.Order = loNone
          Data = {
            06080000000000000000507A40DD000000035265640000000000F08040000000
            200659656C6C6F770000000000E087400000002005477265656E000000000080
            794000000020064F72616E676500000000000883400000002005576869746500
            00000000406D40FCABEE000450696E6B0000000000D083400000002004426C75
            6500000000006882409F9F9F000447726179}
        end
        object GridBandTool1: TGridBandTool
          Band1.Transparency = 92
          Band2.Transparency = 100
          AxisID = 2
        end
      end
(the above creates a new chart ("chart4") with a Pie series (Series5) and some values.

2) Edit the "OnClick" event of the "Series5" object:

Code: Select all

procedure TForm1.Series5Click(Sender: TChartSeries; ValueIndex: Integer;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
Chart4.Title.Text.Text:=sender.ValueMarkText[valueindex];
end;
3) Run the application.

4) Click on a slice... at 80% of times, you'll see, in the title, the description of the clicked slice (in this example, the description is the color name of the slice). But sometimes, it is wrong.

In particular:
- Click the pink slice, half-near the white one
- Click the green slice, near the orange or the yellow one
- Click the yellow slice, near the red one
- Click the right-half blue slice, near the grey one
You'll see wrong description, cause of wrong ValueIndex returned.

Why?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Sep 19, 2005 2:18 pm

Hi NoName,

Yes, this is a known bug already listed on our defect list to be fixed for future releases.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply