zero mark does not always display

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
JimR
Newbie
Newbie
Posts: 46
Joined: Mon Oct 24, 2016 12:00 am

zero mark does not always display

Post by JimR » Sat Mar 11, 2017 6:55 pm

I have axes set to automatically display. Results usually good but sometimes I get a result shown on the attached screenshot. The '0' mark is not displayed on either the left or the bottom axes. Is there an option to force the '0' to always be displayed?
Attachments
left axis.png
left axis.png (2.61 KiB) Viewed 26774 times

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

Re: zero mark does not always display

Post by Yeray » Mon Mar 13, 2017 11:01 am

Hello,

Could you please try to arrange a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.
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

JimR
Newbie
Newbie
Posts: 46
Joined: Mon Oct 24, 2016 12:00 am

Re: zero mark does not always display

Post by JimR » Sat Mar 18, 2017 3:03 am

I will try to create one but this problem is in part of a rather large program.

JimR
Newbie
Newbie
Posts: 46
Joined: Mon Oct 24, 2016 12:00 am

Re: zero mark does not always display

Post by JimR » Wed Nov 22, 2017 4:46 pm

I believe I have figured out the problem. When teechart automatically creates a series of marks to correspond to the tic marks it may determine one value to be a very small but nonzero number (like 10^-15). It is not 0.0 so it gives up and displays a blank. When using the chart edit I can change that value to 0.0 and then it displays correctly.

Jim

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

Re: zero mark does not always display

Post by Yeray » Thu Nov 23, 2017 8:20 am

Hello Jim,

I'm trying to reproduce the problem but I always get all the axis labels drawn.

First, having values in the order of e-15, I get all the labels in the left axis rounded to 0:
Project2_2017-11-23_09-17-49.png
Project2_2017-11-23_09-17-49.png (10.29 KiB) Viewed 26526 times

Code: Select all

uses Series, Math;

const exp = -15;

procedure TForm1.FormCreate(Sender: TObject);
var base: Double;
begin
  base:=Power(10, 15);

  Chart1.View3D:=False;

  with Chart1.AddSeries(TPointSeries) as TPointSeries do
  begin
    Add(2.2/base);
    Add(3/base);
    Add(-5/base);
    Add(-4/base);
  end;

  Chart1.Axes.Left.SetMinMax(-9/base, 6/base);
  Chart1.Axes.Left.LabelsExponent:=True;
end;
Using ValueFormat and AxisValuesFormat I an see the real values both in the legend and in the left axis labels.
In this case, I still see a label where the '0' should be, but it's represented as a really small value () instead of just '0':
Project2_2017-11-23_09-18-19.png
Project2_2017-11-23_09-18-19.png (14.69 KiB) Viewed 26532 times

Code: Select all

uses Series, Math;

const exp = -15;

procedure TForm1.FormCreate(Sender: TObject);
var base: Double;
    myValueFormat: string;
begin
  base:=Power(10, 15);
  myValueFormat:='#.# x10E-#';

  Chart1.View3D:=False;

  with Chart1.AddSeries(TPointSeries) as TPointSeries do
  begin
    Add(2.2/base);
    Add(3/base);
    Add(-5/base);
    Add(-4/base);
    ValueFormat:=myValueFormat;
  end;

  Chart1.Axes.Left.SetMinMax(-9/base, 6/base);
  Chart1.Axes.Left.LabelsExponent:=True;
  Chart1.Axes.Left.AxisValuesFormat:=myValueFormat;
end;
To solve it I can use OnGetAxisLabel event as follows:
Project2_2017-11-23_09-17-49.png
Project2_2017-11-23_09-17-49.png (10.29 KiB) Viewed 26526 times

Code: Select all

procedure TForm1.Chart1GetAxisLabel(Sender: TChartAxis; Series: TChartSeries;
  ValueIndex: Integer; var LabelText: string);
var index, tmpExp: Integer;
begin
  if (Sender=Chart1.Axes.Left) then
  begin
    index:=Pos('E', LabelText);
    tmpExp:=StrToInt(Copy(LabelText, index+1, Length(LabelText)));

    if tmpExp<exp then
       LabelText:='0';
  end;
end;
Attachments
Project2_2017-11-23_09-18-29.png
Project2_2017-11-23_09-18-29.png (14.44 KiB) Viewed 26524 times
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

JimR
Newbie
Newbie
Posts: 46
Joined: Mon Oct 24, 2016 12:00 am

Re: zero mark does not always display

Post by JimR » Fri Nov 24, 2017 5:00 am

I have also found it difficult to construct a little test program to demonstrate the problem. I have attached screenshots to illustrate the problem and to show the values I find when I use the editor.

The lower plot shows a little of the left axis with the blank where a zero should be. I have overlapped it with the editor displaying chart.axis.items. You can see a strange value where one would expect a 0. The other screenshot shows what one gets after unchecking 'automatic' so I can widen the control so you can see the value (-2.77555756289E-16) that is there.

It looks like some rounding error in stepping from -1.4 to 1.4. Zero comes out a little off.

I hopes this helps clarify the problem.

Jim
Attachments
Screen Shot 11-23-17 at 11.43 PM.PNG
Screen Shot 11-23-17 at 11.43 PM.PNG (15.69 KiB) Viewed 26512 times
Screen Shot 11-23-17 at 11.42 PM.PNG
With the control showing the values made wider to the 'zero' value can be seen.
Screen Shot 11-23-17 at 11.42 PM.PNG (25.98 KiB) Viewed 26516 times

JimR
Newbie
Newbie
Posts: 46
Joined: Mon Oct 24, 2016 12:00 am

Re: zero mark does not always display

Post by JimR » Sat Nov 25, 2017 12:11 am

If it helps, the min and max values for that axis were: -1.51940616855679 and 1.59310121515679. The increment shows as blank because it was automatically generated. Within the editor I tried various values for the increment but the zero item still displayed as blank. Within the editor I then played around changing the min and max values. The scale changed of course but the zero label stayed blank.

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

Re: zero mark does not always display

Post by Yeray » Mon Nov 27, 2017 9:00 am

Hello Jim,

Thanks for the screenshots and comments but I'm still unable to reproduce the problem.
JimR wrote:I have also found it difficult to construct a little test program to demonstrate the problem.
If you can export the chart to a .tee file and send it to us, it may help us to reproduce the problem.
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

JimR
Newbie
Newbie
Posts: 46
Joined: Mon Oct 24, 2016 12:00 am

Re: zero mark does not always display

Post by JimR » Sun Dec 03, 2017 4:22 am

Sorry for the delay - I was working on another part of the software. I just tried as an XML file but the forum does not seem to allow one to upload xml files. I just tried the .txt extension and the .tee extensions and they are rejected also. What format should I use?

JimR
Newbie
Newbie
Posts: 46
Joined: Mon Oct 24, 2016 12:00 am

Re: zero mark does not always display

Post by JimR » Sun Dec 03, 2017 1:33 pm

I guess i could just paste it in. See below.

Code: Select all

<?xml version="1.0" encoding="UTF-16"?>
<TChart>
  <Left value="1"/>
  <Top value="1"/>
  <Width value="598"/>
  <Height value="467"/>
  <BackWall>
    <Brush>
      <Gradient>
        <Direction value="gdBottomTop"/>
        <EndColor value="clWhite"/>
        <StartColor value="15395562"/>
        <Visible value="True"/>
      </Gradient>
    </Brush>
    <Pen>
      <Color value="clGray"/>
      <Width value="3"/>
      <Fill>
        <Color value="clRed"/>
        <BackColor value="clRed"/>
        <Gradient>
          <EndColor value="clWhite"/>
        </Gradient>
      </Fill>
      <SmallDots value="True"/>
    </Pen>
    <Transparent value="False"/>
  </BackWall>
  <Border>
    <Width value="2"/>
    <Fill>
      <Color value="clBlack"/>
      <BackColor value="clGreen"/>
      <HatchStyle value="hs05Percent"/>
    </Fill>
  </Border>
  <Foot>
    <Font>
      <Color value="clBlue"/>
      <Name value="'Verdana'"/>
    </Font>
  </Foot>
  <Gradient>
    <Direction value="gdBottomTop"/>
    <EndColor value="clWhite"/>
    <MidColor value="15395562"/>
    <StartColor value="15395562"/>
  </Gradient>
  <LeftWall>
    <Color value="14745599"/>
  </LeftWall>
  <Legend>
    <Font>
      <Name value="'Verdana'"/>
    </Font>
    <Shadow>
      <Transparency value="0"/>
    </Shadow>
    <Visible value="False"/>
  </Legend>
  <RightWall>
    <Color value="14745599"/>
  </RightWall>
  <SubTitle>
    <Text>
      <Strings>
        <String value="''"/>
      </Strings>
    </Text>
  </SubTitle>
  <Title>
    <Font>
      <Name value="'Verdana'"/>
    </Font>
    <Text>
      <Strings>
        <String value="''"/>
      </Strings>
    </Text>
  </Title>
  <BottomAxis>
    <Automatic value="False"/>
    <AutomaticMaximum value="False"/>
    <AutomaticMinimum value="False"/>
    <Axis>
      <Color value="4210752"/>
    </Axis>
    <Grid>
      <Color value="clGray"/>
      <Style value="psDot"/>
    </Grid>
    <LabelsFormat>
      <Font>
        <Name value="'Verdana'"/>
      </Font>
    </LabelsFormat>
    <LabelStyle value="talValue"/>
    <Maximum value="3.561981547518495000"/>
    <Minimum value="-4.310754115229005000"/>
    <TicksInner>
      <Color value="11119017"/>
    </TicksInner>
    <Title>
      <Caption value="'Dim-1'"/>
      <Font>
        <Name value="'Verdana'"/>
      </Font>
    </Title>
  </BottomAxis>
  <Chart3DPercent value="1"/>
  <DepthAxis>
    <Axis>
      <Color value="4210752"/>
    </Axis>
    <Grid>
      <Color value="11119017"/>
    </Grid>
    <LabelsFormat>
      <Font>
        <Name value="'Verdana'"/>
      </Font>
    </LabelsFormat>
    <TicksInner>
      <Color value="11119017"/>
    </TicksInner>
    <Title>
      <Font>
        <Name value="'Verdana'"/>
      </Font>
    </Title>
  </DepthAxis>
  <DepthTopAxis>
    <Axis>
      <Color value="4210752"/>
    </Axis>
    <Grid>
      <Color value="11119017"/>
    </Grid>
    <LabelsFormat>
      <Font>
        <Name value="'Verdana'"/>
      </Font>
    </LabelsFormat>
    <TicksInner>
      <Color value="11119017"/>
    </TicksInner>
    <Title>
      <Font>
        <Name value="'Verdana'"/>
      </Font>
    </Title>
  </DepthTopAxis>
  <Frame>
    <Color value="clGray"/>
    <Width value="3"/>
    <Fill>
      <Color value="clRed"/>
      <BackColor value="clRed"/>
      <Gradient>
        <EndColor value="clWhite"/>
      </Gradient>
    </Fill>
    <SmallDots value="True"/>
  </Frame>
  <LeftAxis>
    <Automatic value="False"/>
    <AutomaticMaximum value="False"/>
    <AutomaticMinimum value="False"/>
    <Axis>
      <Color value="4210752"/>
    </Axis>
    <AxisValuesFormat value="'#.##'"/>
    <Grid>
      <Color value="clGray"/>
      <Style value="psDot"/>
    </Grid>
    <LabelsFormat>
      <Font>
        <Name value="'Verdana'"/>
      </Font>
    </LabelsFormat>
    <Maximum value="2.244051588736541000"/>
    <Minimum value="-2.572340381380857000"/>
    <TicksInner>
      <Color value="11119017"/>
    </TicksInner>
    <Title>
      <Caption value="'Dim-2'"/>
      <Font>
        <Name value="'Verdana'"/>
      </Font>
    </Title>
  </LeftAxis>
  <RightAxis>
    <Axis>
      <Color value="4210752"/>
    </Axis>
    <Grid>
      <Color value="11119017"/>
    </Grid>
    <LabelsFormat>
      <Font>
        <Name value="'Verdana'"/>
      </Font>
    </LabelsFormat>
    <TicksInner>
      <Color value="11119017"/>
    </TicksInner>
    <Title>
      <Font>
        <Name value="'Verdana'"/>
      </Font>
    </Title>
  </RightAxis>
  <TopAxis>
    <Axis>
      <Color value="4210752"/>
    </Axis>
    <Grid>
      <Color value="11119017"/>
    </Grid>
    <LabelsFormat>
      <Font>
        <Name value="'Verdana'"/>
      </Font>
    </LabelsFormat>
    <TicksInner>
      <Color value="11119017"/>
    </TicksInner>
    <Title>
      <Font>
        <Name value="'Verdana'"/>
      </Font>
    </Title>
  </TopAxis>
  <View3D value="False"/>
  <View3DWalls value="False"/>
  <Align value="alClient"/>
  <BevelOuter value="bvNone"/>
  <BorderWidth value="2"/>
  <Color value="clWhite"/>
  <UseDockManager value="False"/>
  <ParentShowHint value="False"/>
  <ShowHint value="True"/>
  <TabOrder value="0"/>
  <ExplicitHeight value="187"/>
  <DefaultCanvas value="'TGDIPlusCanvas'"/>
  <ColorPaletteIndex value="0"/>
  <TPointSeries>
    <Marks>
      <Transparent value="True"/>
      <Visible value="True"/>
      <TextAlignment value="taRightJustify"/>
      <Style value="smsLabel"/>
      <Arrow>
        <Visible value="False"/>
      </Arrow>
      <Callout>
        <Arrow>
          <Visible value="False"/>
        </Arrow>
        <Length value="6"/>
      </Callout>
      <TextAlign value="taRightJustify"/>
    </Marks>
    <Title value="'Grp1'"/>
    <ClickableLine value="False"/>
    <Pointer>
      <Brush>
        <Color value="clRed"/>
      </Brush>
      <InflateMargins value="True"/>
      <Pen>
        <Color value="clRed"/>
      </Pen>
      <Style value="psRectangle"/>
    </Pointer>
    <XValues>
      <Name value="'X'"/>
      <Order value="loNone"/>
    </XValues>
    <YValues>
      <Name value="'Y'"/>
      <Order value="loNone"/>
    </YValues>
    <Data>
      <String value="0510000000E6305A5EC0DC034013BF6A070915DB3FFF01000000312101D6659"/>
      <String value="080340BD05BCDB4BACCE3FFF01000000323F3487BFF59A00400F908E59E9749"/>
      <String value="BFFF01000000333678A85D7E6EF63FFE7CD2176C81CCBFFF010000003428D12"/>
      <String value="3E499CF83F5F211A897214BB3FFF0100000035575C37936C14F73FB79B4F081"/>
      <String value="6BCA3FFF0100000036FD667D4E252AE13FA107CF277639A33FFF0100000037B"/>
      <String value="BE4CA233F4D83F40F616990187C03FFF0100000038D4CA0E613390D9BF06D23"/>
      <String value="EB730EECBFFF01000000394612894FE1F9DD3F92016B773A8A7B3FFF0200000"/>
      <String value="31308E688BDE2D91C33FE3D5B4F030C1E4BFFF020000003131E2881367CCE80"/>
      <String value="C067A9223436A9E6BFFF020000003132C19182FA082EF6BF003CB35F9911AB3"/>
      <String value="FF0200000031330D6A6ADC1B3C05C06E454C5B9FA6E03FFF020000003134131"/>
      <String value="EF661CA906C0FF32BD6B1C8DE13FFF02000000313515DC2DD73CDA09C004A31"/>
      <String value="E1C1A2CB3FFF020000003136"/>
    </Data>
  </TPointSeries>
  <TArrowSeries>
    <Legend>
      <Visible value="False"/>
    </Legend>
    <Active value="False"/>
    <Marks>
      <Frame>
        <Visible value="False"/>
      </Frame>
      <Transparent value="True"/>
    </Marks>
    <ShowInLegend value="False"/>
    <ClickableLine value="False"/>
    <Pointer>
      <InflateMargins value="False"/>
      <Pen>
        <Style value="psDot"/>
      </Pen>
      <Style value="psRectangle"/>
    </Pointer>
    <XValues>
      <Name value="'X'"/>
      <Order value="loNone"/>
    </XValues>
    <YValues>
      <Name value="'Y'"/>
      <Order value="loNone"/>
    </YValues>
    <EndXValues>
      <Name value="'EndX'"/>
      <Order value="loNone"/>
    </EndXValues>
    <EndYValues>
      <Name value="'EndY'"/>
      <Order value="loNone"/>
    </EndYValues>
    <StartXValues>
      <Name value="'X'"/>
      <Order value="loNone"/>
    </StartXValues>
    <StartYValues>
      <Name value="'Y'"/>
      <Order value="loNone"/>
    </StartYValues>
    <Data>
      <String value="011000000000000000000000000000000000000000E6305A5EC0DC034013BF6"/>
      <String value="070915DB3F000000000000000000000000000000002101D6659D080340BD05B"/>
      <String value="DB4BACCE3F000000000000000000000000000000003F3487BFF59A00400F908"/>
      <String value="59E9749EBF000000000000000000000000000000003678A85D7E6EF63FFE7CD"/>
      <String value="176C81CCBF0000000000000000000000000000000028D1273E499CF83F5F211"/>
      <String value="897214BB3F00000000000000000000000000000000575C37936C14F73FB79B4"/>
      <String value="08166BCA3F00000000000000000000000000000000FD667D4E252AE13FA107C"/>
      <String value="277639A33F00000000000000000000000000000000B9BE4CA233F4D83F40F61"/>
      <String value="990187C03F00000000000000000000000000000000D4CA0E613390D9BF06D23"/>
      <String value="EB730EECBF000000000000000000000000000000004612894FE1F9DD3F92016"/>
      <String value="773A8A7B3F000000000000000000000000000000008E688BDE2D91C33FE3D5B"/>
      <String value="F030C1E4BF00000000000000000000000000000000E2881367CCE802C067A92"/>
      <String value="3436A9E6BF00000000000000000000000000000000C19182FA082EF6BF003CB"/>
      <String value="5F9911AB3F000000000000000000000000000000000D6A6ADC1B3C05C06E454"/>
      <String value="5B9FA6E03F000000000000000000000000000000001312EF661CA906C0FF32B"/>
      <String value="6B1C8DE13F0000000000000000000000000000000015DC2DD73CDA09C004A31"/>
      <String value="E1C1A2CB3F"/>
    </Data>
  </TArrowSeries>
  <TDragMarksTool Name="ChartTool1">
    <Active value="False"/>
  </TDragMarksTool>
</TChart>

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

Re: zero mark does not always display

Post by Yeray » Mon Dec 04, 2017 7:42 am

Hello,
JimR wrote:I just tried as an XML file but the forum does not seem to allow one to upload xml files. I just tried the .txt extension and the .tee extensions and they are rejected also. What format should I use?
This exportation allows you to obtain a readable xml output with the objects and properties defined in a chart, but the xml generated can't be imported.
The native option designed to be importable is the .tee, in binary or text format.
You can put the .tee file into a .zip and the forum should allow you to attach it.
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

JimR
Newbie
Newbie
Posts: 46
Joined: Mon Oct 24, 2016 12:00 am

Re: zero mark does not always display

Post by JimR » Mon Dec 04, 2017 5:41 pm

OK, here is a zip of the binary .tee file.
Attachments
mxplot.zip
(1.75 KiB) Downloaded 963 times

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

Re: zero mark does not always display

Post by Yeray » Tue Dec 05, 2017 8:59 am

Hello,

I see the Chart1.Axes.Left.AxisValuesFormat is set to '#.##'. Note this AxisValuesFormat is used to convert the axis values to the labels strings, and this returns an empty string:

Code: Select all

FormatFloat('#.##', 0);
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

JimR
Newbie
Newbie
Posts: 46
Joined: Mon Oct 24, 2016 12:00 am

Re: zero mark does not always display

Post by JimR » Tue Dec 05, 2017 7:44 pm

OK, I thought it had been still set to the default. I now create the format as needed. Thanks.

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

Re: zero mark does not always display

Post by Yeray » Mon Dec 11, 2017 7:49 am

Hello Jim,
JimR wrote:I thought it had been still set to the default
By default it should be set to '#,##0.###'.
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