Incorrect bar width with TChartScrollBar

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Eic
Newbie
Newbie
Posts: 18
Joined: Mon Apr 18, 2016 12:00 am

Incorrect bar width with TChartScrollBar

Post by Eic » Tue Nov 29, 2016 2:36 pm

Hello
I have set up the following code.

Code: Select all

	TChart * Chart1 = new TChart(this);
	TChartScrollBar *scrollBar = NULL;
	Chart1->Parent = this;
	Chart1->Align = alClient;

	Chart1->AddSeries(new THorizBarSeries(Chart1))->FillSampleValues(20);
	Chart1->LeftAxis->Minimum = 0;
	Chart1->LeftAxis->Maximum = 5;
	Chart1->LeftAxis->Automatic = false;

	scrollBar = new TChartScrollBar(this);
	scrollBar->Parent = this;
	scrollBar->Align = alRight;
	scrollBar->Kind = sbVertical;
	scrollBar->Width = 17;
	scrollBar->Min = 0;
	scrollBar->Max = 100;
	scrollBar->Chart = Chart1;
	scrollBar->RecalcPosition();
When my series is composed of 5 values (FillSampleValues (5)), I get this...
5_items.png
5_items.png (25.94 KiB) Viewed 6325 times
When my series is composed of 100 values (FillSampleValues (100)), I get this...
100_items.png
100_items.png (34.95 KiB) Viewed 6322 times
Since Chart1-> LeftAxis-> Maximum is always 5, I would like that in both cases, my bars have the same width.

In my example, with 100 values, the bars are very small whereas there is ample room to display them. He pretends to put all the bars on a single page.

What should be done ?

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

Re: Incorrect bar width with TChartScrollBar

Post by Yeray » Wed Nov 30, 2016 9:56 am

Hello,

Try setting your bar series AutoBarSize property to true:

Code: Select all

  THorizBarSeries *horizBar1 = new THorizBarSeries(Chart1);
  Chart1->AddSeries(horizBar1);
  horizBar1->FillSampleValues(20);
  horizBar1->AutoBarSize=true;
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

Eic
Newbie
Newbie
Posts: 18
Joined: Mon Apr 18, 2016 12:00 am

Re: Incorrect bar width with TChartScrollBar

Post by Eic » Wed Nov 30, 2016 2:51 pm

Thanks, this solution works

Post Reply