Watch, Follow, &
Connect with Us

Welcome, Guest
Guest Settings
Help

Thread: Showing zero values on bar chart


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 5 - Last Post: Jan 11, 2017 2:09 AM Last Post By: Yeray Alonso Threads: [ Previous | Next ]
bokosoft doo

Posts: 2
Registered: 12/4/03
Showing zero values on bar chart  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 4, 2017 6:39 AM
Hello!

We are using frxChartView in FR 5.4 in C++ Builder XE2 with TeeChart Standard 2013 to present data in Bar series.
Problem we are facing is that values 0,0 aren't shown on a chart - it loks like the data is missing. How can we achieve that also zero (0.00) values will be shown on Bar chart (Y value).
We are experiancing the same issue on TDBChart from TeeChart.

Thank you in advance!
Yeray Alonso

Posts: 60
Registered: 6/12/11
Re: Showing zero values on bar chart  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 4, 2017 6:53 AM   in response to: bokosoft doo in response to: bokosoft doo
Hello,

bokosoft doo wrote:
Problem we are facing is that values 0,0 aren't shown on a chart - it loks like the data is missing. How can we achieve that also zero (0.00) values will be shown on Bar chart (Y value).

By default, the TBarSeries are drawn with an YOrigin=0. In that case, how would expect a bar with a 0 value to be drawn?
If you want the bars to be drawn from a value lower to 0, you can set it as follows:

  Series1.YOrigin:=-100;


--
Best Regards,

Yeray Alonso
Steema Software
Facebook, Twitter, GPlus, LinkedIn, YouTube, GitHub, RSS
Support Options
bokosoft doo

Posts: 2
Registered: 12/4/03
Re: Showing zero values on bar chart  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 11, 2017 1:44 AM   in response to: Yeray Alonso in response to: Yeray Alonso
I have tried to set YOrigin to -1, but nothing happens.

Yeray Alonso wrote:
Hello,

bokosoft doo wrote:
Problem we are facing is that values 0,0 aren't shown on a chart - it loks like the data is missing. How can we achieve that also zero (0.00) values will be shown on Bar chart (Y value).

By default, the TBarSeries are drawn with an YOrigin=0. In that case, how would expect a bar with a 0 value to be drawn?
If you want the bars to be drawn from a value lower to 0, you can set it as follows:

  Series1.YOrigin:=-100;


--
Best Regards,

Yeray Alonso
Steema Software
Facebook, Twitter, GPlus, LinkedIn, YouTube, GitHub, RSS
Support Options
Yeray Alonso

Posts: 60
Registered: 6/12/11
Re: Showing zero values on bar chart  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 11, 2017 2:09 AM   in response to: bokosoft doo in response to: bokosoft doo
Hello,

bokosoft doo wrote:
I have tried to set YOrigin to -1, but nothing happens.

Depending on the values in your TBarSeries, -1 could be too small to see the difference. Try with a bigger YOrigin. Ie:

uses Series;
 
procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.View3D:=False;
  Chart1.Legend.Visible:=False;
 
  with Chart1.AddSeries(TBarSeries) as TBarSeries do
  begin
    Marks.Visible:=False;
    FillSampleValues();
 
    YValue[2]:=0;
    YOrigin:=-MaxYValue/100;
  end;
end;


--
Best Regards,

Yeray Alonso
Steema Software
Facebook, Twitter, GPlus, LinkedIn, YouTube, GitHub, RSS
Support Options
Robert Triest

Posts: 590
Registered: 3/24/05
Re: Showing zero values on bar chart  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 4, 2017 8:19 AM   in response to: bokosoft doo in response to: bokosoft doo
I think you mean that 0 Y-Value bars are not drawn at all..
Can't you consider/change a 0 value to be a very small number, like 0,00001?
Yeray Alonso

Posts: 60
Registered: 6/12/11
Re: Showing zero values on bar chart  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 4, 2017 11:43 PM   in response to: Robert Triest in response to: Robert Triest
Hello,

Robert Triest wrote:
I think you mean that 0 Y-Value bars are not drawn at all..
Can't you consider/change a 0 value to be a very small number, like 0,00001?

I've checked both with v2013.09 and the current v2016.19 and both behave the same:
In 3D an horizontal plane is drawn, while in 2D these "0" values are drawn as an horizontal line. However, in 2D this horizontal line may be drawn at the same position than the horizontal axis (if the axis minimum is 0, as per default when using +TBarSeries+) so it can't be seen by default.
If your TBarSeries has marks visible, the "0" values are indicated even if no bar/line can be seen. However, if you hide the marks then you may see nothing at all.

Another alternative could be to give some space in the axis:

  Chart1.Axes.Left.MinimumOffset:=1;


--
Best Regards,

Yeray Alonso
Steema Software
Facebook, Twitter, GPlus, LinkedIn, YouTube, GitHub, RSS
Support Options
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02