Graphs in V5 can be quite fun and another powerful feature of AwareIM if you just employ a few simple techniques.
The description below is really for developers with a good understanding of AwareIM. So I've just added charts to one of my applications quite successfully and amazed my users by doing the following:
The first thing you need to recognise is that queries displaying graphs do not summarize the data. You need to have this already loaded into a BO. I wont go into this as this is different for each application. Suffice
to say that I am going to display my data in years along the X axis or months for a selected year or days for a selected year and month. You therefore need to set up and store your data along those lines. When storing data in years I set ChartYears=0 and ChartMonths=0. When storing the data in months I set Years equal to the year concerned and months = 0 as each month is represented by a different instance of the BO where the XAxis is set to the month number 1 to 12. Finally when storing data in days I set Years equal to the year concerned, months
equal to the month concerned and then would have up to 31 instances of each with the XAxis set to the day number 1 to 31.
So I set up a generic BO called BOChart to hold my graph data with the following structure:
XAxis Number
YAxis1 Number
YAxis2 Number
XAxisText Text
TimeSeries Text
ChartData Text
ChartYears Number
ChartMonths Number
You can have as many YAxis(n) as you like to present as different times series on say a Bar chart. The XAxis as a number might represent months of the year 1 to 12 or days of a month or years but the XAxisText might be say the month names. ChartData is used to distinguish different sets of data within the same BS and finally the attribute TimeSeries I set to either Y (Years), M (Months) or D (Days), in otherwords to allow the user to slice and dice the same data.
Then I added attibutes to my login BO RegularUser, ChartTimeSeries, ChartYears and ChartMonths.
Next create several sets of chart queries with each set selecting the same ChartData instances from the BO ChartData but displaying data in different types of graph. For example for graphing communications there might be two queries each with the same selection but one displaying a bar chart and the other a pie chart:
BOChart.TimeSeries=LoggedInRegularUser.ChartTimeSeries and BOChart.ChartYears=LoggedInRegularUser.ChartYears and
BOChart.ChartMonths=LoggedInRegularUser.ChartMonths and BOChart.Data='Communications'
Then create a process that prompts the user for the ChartTimeSeries, ChartYears and ChartMonths which it stores on the RegularUser BO.
Finally set up your chart options within each query but add the process above to be called.
Remember you can add attributes within the chart heading using the << >> structure that might contain the year being displayed for example when the timeseries is set to M.
Now when the query is displayed from within the BS it displays your inital graph which for me was in years on the X axis. When the user clicks on the graph the process kicks off and presents the user with a drop down box to select a different time series. If they choose M then a list of years is displayed to choose from. If they choose days then a list of years and months is displayed. The user makes their selection and the graph refreshes with the appropriate time series along the X axis!!!
So the user sees their data in a lovely graph and they can move between different time series along the X Axis slicing and dicing through the data. With each new display the chart heading changes accordingly letting them
know what they are viewing. One moment they are displaying years, then they click on the graph and choose a year and it displays the months for that year and then they click on the graph again and choose another year or slice down into a selected month for that year!
All in all I am continually amazed at the power of AwareIm and the ease of development!
Cheers Rod
For each type of chart eg pie or bar I would create a different query, modifying the BOCHart