How can you use variables with a frxChartObject

edited 4:05PM in FastReport 4.0
I'm new (this is day 3) to using FastReports and need a bit of help. I have a report with the following dataset columns displayed on my MasterData band:

Q1Budget, Q2Budget, Q3Budget, Q4Budget
Q1Spent, Q2Spent, Q3Spent, Q4Spent

I then use a simple variable defined in Fastreports called AnnualBudgetTotal and AnnualSpentTotal. These two variables are displayed flawlessly in the MasterData band to the right of "Q4" above and simply consist of an expression adding up the columns.

My question comes with trying to use those two variables in a chart. I defined a two column bar chart in the MasterData band and want to use AnnualSpentTotal for one bar and <AnnualBudgetTotal>*(<DayofTheYear>/365) as the other bar. The problem I'm having is I've found no way to get the chart to read a variable. If I select "Fixed data" it seems to expect text constants and if I pick data band, it seems to only allow variables from my dataset.

Is there a way to chart FastReport variables I've created? If so, what is the syntax?

I've searched the forums and documentation but have yet to find what I'm looking for.

Thanks in advance,
Mike

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 4:05PM
    Mike
    you can write code to populate the xsource and ysource values for fixed data
    just select fixed data and leave the values empty.
    in the obp event of the chart object write code to set the values.
    sample
    Chart1.SeriesData[0].XSource := 'Jan;Feb;Mar;Apr';

    Chart1.SeriesData[0].YSource := '31;28;31;30';
    note that the values are a string of semicolon separated values
    ie
    Chart1.SeriesData[0].XSource := '+<var1>+';'+<var2>+';'+<var3>+':'+<Var4>+';



  • edited 4:05PM
    gordk, thanks for the reply. Unfortunately, when I select my frxChartObject and then the Events tab, the object inspector shows no events whatsoever. I'll poke around a bit more, but as yet I'm unclear why there are no events listed.

    Mike
  • gordkgordk St.Catherines On. Canada.
    edited 4:05PM
    sounds like you are using a basic version or the version that ships with XE.
  • edited 4:05PM
    Thanks gordk. That explains it. I'll need some more experience with FR before deciding to get an expanded version. In the mean time, I'll give up on graphing report variables.

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.