3

I'm trying to figure it out how to set a fixed size to the bars' width in TChart.

I've tried to search a lot for a similar "problem", but I may be using the wrong terms, because I found no related topics in the internet.

My chart has Horizontal Scrolling enabled, so I would like to have bars with the same width regardless how many bars are in the chart.

Here's a sample where I added 10 sample values and, for my purpose, this bar width is acceptable:

10 bars

But when I add 40 sample values, for example, the bars became so thin, even when showing only 10 values and letting all the others visible only after scroll the bars to the left:

more bars

Here's the code I'm using to add the sample values (just for you to see there's nothing special):

procedure TForm5.Button1Click(Sender: TObject);
var
    i: Integer;
begin
    for i := 0 to ChartFatGrupoPerc.SeriesCount-1 do
        ChartFatGrupoPerc.Series[i].FillSampleValues(StrToInt(eItems.Text));
    ChartFatGrupoPerc.BottomAxis.Maximum := StrToInt(eMax.Text);
    ChartFatGrupoPerc.BottomAxis.Minimum := StrToInt(eMin.Text);
end;

So, the question is: Is there an way I can define the bars' width regardless the amount of values?

Thanks in advance,
Kelver Merlotti [KM]

2
  • AutoBarSize := false; CustomBarWidth:=pickYourChoice; Commented Mar 14, 2016 at 20:32
  • @LURD Sorry for my delay, man! You're right about these properties. Please, post as an answer so I can accept it ;) Commented Mar 31, 2016 at 12:36

1 Answer 1

4

Is there an way I can define the bars' width regardless the amount of values?

Yes, setting these properties would do the trick:

AutoBarSize := false; 
CustomBarWidth := aSuitableNumber;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.