Topic: Bar Chart

Hi there

How can i use bar charts without having on the x axis date or time series.

For instance i want to check the relationship between several kinds of products
having on the x axis the kind and on the y axis the qty amount.

Thanks

Re: Bar Chart

Hello.


Example:

var
     ChartBar: TChart;  

procedure Form1_OnShow (Sender: string; Action: string);
begin
  ChartBar := TChart.Create(Form1);
  ChartBar.Parent := Form1.PanelBar;
  ChartBar.Align := alClient;
  ChartBar.AddSeries(TBarSeries.Create(ChartBar));
  TBarSeries(ChartBar.Series[0]).Marks.Visible := False;
  Form1.bBarUpdate.Click;
end;


procedure Form1_bBarUpdate_OnClick (Sender: string; var Cancel: boolean);
var
    Results: TDataSet;
    sProduct: string;
    QtyValue: string;
    x: integer;
begin
    ChartBar.Series[0].Clear;
    x := 1;

    SQLQuery('SELECT product, qty FROM bar_data', Results);

    while not Results.Eof do
    begin
        sProduct := Results.FieldByName('product').asString;
        QtyValue := Results.FieldByName('qty').asString;

        if ValidInt(QtyValue) then ChartBar.Series[0].AddXY(x, StrToInt(QtyValue), sProduct);

        Results.Next;
        Inc(x);
    end;
end;
Dmitry.

Re: Bar Chart

Better than this is almost impossible;

Thanks so much!

4 (edited by luisfilipeipam 2016-12-27 08:59:27)

Re: Bar Chart

It's me again.

How can i parametrize labels and titles in charts? i.e. is it possible to make x label invisible or Graph title in bold, for instance ...?
Can i consult any documentation about tchart class?

One more question:

Is it possible to have two graphs in the same area? I want to display a Pareto Diagram like the one on the image.

Many thanks

Post's attachments

Attachment icon ParetoDiagram.png 681.59 kb, 271 downloads since 2016-12-27 

Re: Bar Chart

Hello.

Sorry for delay. I was on vacation.
The question is still relevant for you?

Dmitry.