Working with Composite UltraCharts - Forum - OpenEdge Development - Progress Community

Working with Composite UltraCharts

 Forum

Working with Composite UltraCharts

  • Not having learned when enough is enough I've embarked on an adventure to try to get a composite UltraChart working.

    So I have spent a good chunk of yesterday and today grinding through the documentation, the samples and the infragistics forums and stuff.

    Step 1 was to simply replace an ordinary chart with a composite chart with just one layer. This, sort of, works.

    However I wouldn't be posting if it worked perfectly And I'm posting here, rather than at infragistics because 1) I don't speak VB or C# particularly well and 2) I think my issues are largely a result of cognitive dissonance between my data oriented Progress 4GL mindset and the controls oriented VB/C# mindset.

    I think that the core problem is that I don't grok the concept of a NumericSeries as it relates to a chart. I keep trying to think of it as a temp-table but that is clearly wrong. It doesn't really seem to be an array either. In particular it bothers me that:

    series1:DataBind( dTable, dValue, dLabel ).

    is supposed to mean something. "series1" is a NumericSeries. "dTable" is a "DataTable" which I have converted from a Progress temp-table (thanks to Haavard's help from the last go-roubnd with UltraCharts!). The DataTable at least makes sense to me. dTable has 20 rows and 2 columns, a label column and a data column. (The underlying temp-table has 4 colums -- 1 labels, 3 data.)

    I can apparently add as many "series" to a chart as I'd like. But I do not really understand their function and how they are to be used and, from my perspective, the infragistics documentation seems very circular in terms of defining the term.

    One theory that I've formed is that I need a data series for:

    a) The x axis labels

    b) The y values for anything that I want to chart

    If that is correct then I would need to create a "series" for every column in the DataTable. And add each series to the UltraChart. Is that right? I don't think that it is quite right because it doesn't explain the 2 columns provided to Bind() nor does it work if I arbitrarily Add() additional series -- odd things happen then. So my conceptual model seems to be flawed.

    This attached code, sort of works in a limited way. It displays a nice column chart.

    But the idea is to have two layers and show two column charts super-imposed on one another. It seems to me that if I just uncomment the two lines down towards the bottom that that should happen. But instead the chart heads off into the twilight zone...

    Ultimately I'm trying to get to a point where I can have one of the charts be a StackColumnChart and the other a LineChart. But neither of those chart types will work for me with my understanding of series right now.

    Can anyone educate me?

    myCompositeChart.cls

    --
    Tom Bascom
    tom@wss.com

  • Well one problem turns out to be the the dolt who wrote the code above forgot to reopen the query between binding it to various sessions. Fixing that helps but it doesn't explain everything.

    It's getting better but I still think I'm missing a clear understanding of what "series" are all about.

    --
    Tom Bascom
    tom@wss.com

  • > Well one problem turns out to be the the dolt who wrote the code above forgot to reopen the query between binding it to various sessions. Fixing that helps but it doesn't explain everything.

    Reposition-to-row(1) before the do while get-next seems to help also. Or change it to a do while with a get-first before and the get-next at bottom.

    > It's getting better but I still think I'm missing a clear understanding of what "series" are all about.

    The two following settings probably throws you off.

    x2Axis:AxisNumber = AxisNumber:X2_Axis

    y2Axis:AxisNumber = AxisNumber:Y2_Axis

    This is moving the axis to the other (2) side and changes the position of the data area of the chart.

    Try:

    x2Axis:AxisNumber = AxisNumber:X_Axis

    y2Axis:AxisNumber = AxisNumber:Y_Axis

  • Those were making the 2nd chart offset from the 1st but I had a couple of work-arounds for that.

    Poking around last night on the IG boards I found an example that clarified a few minor points like that. One key thing is that I only need a single chartArea -- not two. So I cleaned that up which makes the code a bit smaller and easier to read.

    I now have an example that reliably super-imposes one chart over the other (attached). But I still haven't figured out how to make the first chart a StackColumnChart and the second a LineChart. I'm clearly still missing something regarding the interactions between the chart and its data.

    7318.myCompositeChart.cls

    --
    Tom Bascom
    tom@wss.com

  • Oops -- slightly wrong version of code. To get the layered charts change the bit at the bottom to look like this:

    --
    Tom Bascom
    tom@wss.com

  • One key thing is that I only need a single chartArea

    -- not two. So I cleaned that up which makes the

    code a bit smaller and easier to read.

    I'm not sure about that.

    In any case I'm attaching the example changed to super-impose a PieChart and ColumnChart on top of each other by ensuring that the Bounds of the ChartAreas are the same.

    A LineChart is quite different according to Infragistics doc: Each row is drawn as a single line (or area) on the chart, with a number of points in the line equal to the count of numeric columns in the data set.

    So you need at least two numeric columns for a line chart to show a line.

    5875.myCompositeChart.cls

  • The single ChartArea approach does seem to work. It makes sense to me and simplified things quite nicely too. Plus it came from one of the IG guys who seems to know what he's talking about

    Getting at least two numeric columns (series?) seems to be at the root of all of my current issues.

    When I add 2 or more series to a chart they appear next to each other. (I can understand that that might sometimes be the desired behavior but, to me, it seems like it ought to be the exception rather than the rule.) This leads me to believe that adding additional "series" is not the right way to go. I suspect that I need a way to add more values to a series.

    Specifically I think that my use of:

    is the problem. I may be out in left field but I'm thinking that perhaps I need to make multiple passes through the DataTable? One to set it up like above and then another for each additional column of data? Maybe something like this:

    --
    Tom Bascom
    tom@wss.com

  • Nope, that looks like a dead-end

    For one things the 2nd form is subtly different -- the 1st parameter is a DataSet not a DataTable. The 2nd parameter is the index of the desired Table within the Set rather than the column.

    But why have a method to bind a DataTable if it is only going to use a limited number of columns? That just doesn't seem sensible.

    What is left of my brain is turning to mush and dribbling out my ears...

    --
    Tom Bascom
    tom@wss.com

  • The single ChartArea approach does seem to work. It

    makes sense to me and simplified things quite

    nicely too. Plus it came from one of the IG guys who

    seems to know what he's talking about

    I certainly won't argue with that, but the WinChart/Composite/DataBind sample that we ship uses two ChartAreas and was transformed from an IG sample.

    Getting at least two numeric columns (series?) seems to be at the root of all of my current issues.

    You need to completely twist/invert the data to make them meaningful for the LineChart.

    If you have two rows A and B with columns X, Y, Z a column chart shows it like this The graph height (y-axis) is set from the value of the column.

    X

    Y

    Z

    X

    Y

    Z

    Row A Row B

    In a LineChart the same data is shown like this.

    The y-axis position of the points is decided by the value of the columns

    RowA XYZ

    RowB XYZ

    In your case you have many rows with one column (X)

    |X|      |X|      |X|      |X|

    RowA RowB RowC RowD

    If you want a LineChart to show the same data super imposed so that it matches the column chart, you need a column for each row, so to speak.

    LineRow

    - Column1 = RowA:X

    - Column2 = RowB:X

    - Column3 = RowC:X

    - Column4 = RowD:X

  • I'm guessing that the same sort of "logic" applies to StackColumnChart.

    That seems like what SwapRowsAndColumns does with a DataTable when you use a non-composite chart. But, so far as i can tell, there is nothing similar available when dealing with layers and series?

    So the questions is... how do you make that happen? In good old 4GL code

    It sort of sounds like I'm going to have to dynamically create a series that corresponds to every row in the data table? And an entry in the series for each column?

    The mush is no longer dribbling -- it's gushing

    --
    Tom Bascom
    tom@wss.com

  • The mush is no longer dribbling -- it's gushing

    I guess that is what one has to expect when that which used to be ChUI is now GUI!

    Consulting in Model-Based Development, Transformation, and Object-Oriented Best Practice  http://www.cintegrity.com

  • This little nugget from the IG docs looks promising:

    I think that GetXYSeriesUnBound() is creating the sort of structure that I need... I'll have to fiddle with it later tonight.

    --
    Tom Bascom
    tom@wss.com

  • Where is the Groan feedback button when I need it?

    --
    Tom Bascom
    tom@wss.com

  • Probably hiding under some of that mush ...

    Consulting in Model-Based Development, Transformation, and Object-Oriented Best Practice  http://www.cintegrity.com

  • The mush is no longer dribbling -- it's

    gushing

    I guess that is what one has to expect when that

    which used to be ChUI is now GUI!

    I guess the problem is amplified by the fact that you (and I) have to learn the components, but the core issue here is charting or reporting.

    The reason why I tried to illustrate the 3 column sample case earlier was to illustrate why a column chart and line chart needs to be different.

    In your case you have one column per row. This makes it possible to show the data as a line chart, but a line chart is really a single row of data.

    Here's the important part; If you break your data down to satisfy the line chart then you can use the data to also feed a column chart in this case. You really do not need the column chart capability to show multiple rows when you have a single column in each row. You can show it as a single row and it should appear exactly as it currently does.

    When this is said, I would look for options or settings for this particular one column per row situation. The SwapRowsAndColumns certainly sounds promising, or maybe a line chart can be shown as single column chart or something, or maybe there is a simpler type of column chart. Or it might be as simple as just feeding the data column by column to the chart while you traverse the rows. Tom's last posting might also be onto something .

    Message was edited by:

    Havard Danielsen