Changing chart percentages

Hello.

In FastReport 3.0...

I am having a problem using the tfrxChart component on a report. The problem is in the percentage it shows for the items found. I will give an example:

There are 123 cars found in a filtered search.
7 are red;
5 are green;
3 are black.
15 found in filtered search of TOTAL 123.

What I'm trying to do is show a bar graph that shows the percentage of the total of 123 that each color represents. Instead I am getting the percentage of the total cars listed (15).

It shows: 46.6% (7 / 15) of the red instead of 5.69% (7 / 123).

Any help would be greatly appreciated. I seem to be having a problem understanding the syntax even after going through the help files.

Thank you. ;)

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 6:11AM
    Need more info about series properties
    are you using data source or band source or fixed values.
    if you use band source and specify memos to be used and you hide any bands
    you will get incorrect results.
    seems like you aren't getting the other 108 records.
    ;)
  • edited 6:11AM
    Thanks for the quick reply! ;)

    I'm using two datasets for the report; one is for the bands that show the specific details for each found search and the other is for the frxChartView. I use a second dataset simply because I get ALL the items listed in the chart if I use the first dataset. The second dataset shows only the filtered items. I did this by counting the filtered items and placing a number in an additional field and then copy the records to another db with the number field > 0.

    The band listing works fine...it shows the proper items grouped in their respective place. It's the graph I can't get the proper percentage. If I use the first dataset for the graph, it shows ALL the selections, which gets pretty crowded because it lists everything.

    As you can see, I'm using the datasource for the values in the graph. I thought of adding another "item" to the 2nd db with the difference and labeling it "other" just to get the percentage correct. I figure this way the graph will see the total-total and compute the chart based on the numbers given.

    I may not be too clear on this and it's probably because I've been working on trying to solve this equation for some time and am probably at the "can't see the forest for the trees" area about now. ;)

    Thanks again for the help.
  • gordkgordk St.Catherines On. Canada.
    edited 6:11AM
    the chartview does not need a dataset
    use either a summary or child or mdband set to rowcount of 1 no dataset
    the series
    the series allows you to use a dataset of which 2 fields may be used for x and y values
    or a band again the two items(memos) located in the same band
    1 memo containing aggregate sum 1 containing text from a group footer band
    or a set of fixed values for x and y values.
    the fixed values accept a string of ; separated values the could be
    '10;20;30'
    'txta;textb;textc'
    or they could be variables if declared as typed variables at top of code page
    'a;b;c'
    or if categorized vars
    '<var1>;<var2>;<Var3>'

    Now you can write the following in the chart.onbeforeprint:

    with Chart1.SeriesData[0] do
    begin
    XSource := 'a;b;c';
    YSource := '1;2;0';
    end;

    ;)

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.