How do you get a dynamically created UltraWinChart to chart

Posted by ChUIMonster on 22-Feb-2009 09:53

I have an UltraWinChart on a form.

It doesn't look like much though. Just a title an X axis and a Y axis.

I created it dynamically and I need to tell it what to chart dynamically.

I have set its DataSource to a TT with data and it seems happy about that. But it seems to me that I must also need to tell it what TT field to use for the X axis and which to use for Y. I see the DataMember property and I tried setting it to "Field1,Field2" (which seemed logical) but that had no impact.

So I thought perhaps the axes set their datamember individually? If I were writing the control I'd probably do that... Glancing at the generated code it seemed like something like this might work:

Glancing at the class browser it was clear that this wouldn't actually work. But I tried it anyway. No luck.

So I started looking at the "Data" property which isa "DataAppearance" object. That looks promising but, alas, the documentation is "sparse" and I have not been able to find the proper incantations.

Does anyone know how to do this?

All Replies

Posted by Peter Judge on 23-Feb-2009 09:18

I have set its DataSource to a TT with data and it

seems happy about that. But it seems to me that I

must also need to tell it what TT field to use for

the X axis and which to use for Y. I see the

DataMember property and I tried setting it to

"Field1,Field2" (which seemed logical) but that had

no impact.

There are issues with ABL data and Infragistics charting controls that you may be running into (http://www.psdn.com/library/thread.jspa?threadID=12173&tstart=100).

In what sense is the DataSource happy?

So I started looking at the "Data" property which isa

"DataAppearance" object. That looks promising but,

alas, the documentation is "sparse" and I have not

been able to find the proper incantations.

Does anyone know how to do this?

There should be some (other) posts from the Beta days on this forum about using the charting controls. There's also an example on the Doc CD that you could look at.

-- peter

Posted by ChUIMonster on 23-Feb-2009 09:48

I have set its DataSource to a TT with data and it

seems happy about that.

There are issues with ABL data and Infragistics

charting controls that you may be running into

(http://www.psdn.com/library/thread.jspa?threadID=1217

3&tstart=100).

That wan't very promising

In what sense is the DataSource happy?

It compiles and runs without error. (But apparently does nothing.)

There should be some (other) posts from the Beta days

on this forum about using the charting controls.

I've been fishing around without much luck.

You probably don't want to hear my opinion regarding Jive's "search" "feature".

There's also an example on the Doc CD that you could

look at.

I'm looking at those now. Comments coming up in the other thread.

Posted by Peter Judge on 23-Feb-2009 09:51

You probably don't want to hear my opinion regarding

Jive's "search" "feature".

All Opinions Are Welcome Here To be honest, I probably feel the same ... isn't it interesting how modern search engines (aka Google) have raised the bar on what we expect search to be?

-- peter

Posted by ChUIMonster on 23-Feb-2009 11:01

So that makes Jive what? 1940s technology?

Posted by Thomas Mercer-Hursh on 23-Feb-2009 11:06

No, just a poor search engine ...

You do know that the default is OR instead of AND? When I remember, that occasionally helps.

Posted by ChUIMonster on 23-Feb-2009 11:06

Ok, I stepped back a bit and I now have an example that "does something". It just isn't quite right

This does actually produce a chart from the sports2000 Customer table. I don't have any idea how it is deciding what field is X and what is Y (it looks to me like it is using CustNum for both. Nor how one would specify labels and such.

First a little driver dot-p:

Followed by CustChart.cls (this may, or may not, open in Visual Designer, I hacked out the pointless X2, Y2, Z and Z2 axis definitions...):

Posted by Håvard Danielsen on 24-Feb-2009 14:07

“While it is easy to point the chart to your own custom data, it is not so easy to make sure you are supplying the appropriate amount and type of data that each chart type requires.”

This quote is from Infragistics Online documentation. More specifically from the WinChart – Using Chart – Data – Chart Data Requirements that you can find under Controls and Components, which I pointed to in my previous posting:

http://www.psdn.com/library/thread.jspa?threadID=15533&tstart=0

This section has links that contain a list of each chart type and the requirements of each for receiving data at run time. This is almost required reading if you want to take full advantage of the WinChart component, but you should probably start from the top on the WinChart section.

More teasers:

The Rows and Columns section in the chart Data Requirements continues:

Although the Chart control will automatically select the data to use for row labels from the data set, you can easily override the default choice by using the SetRowLabels and SetColumnLabels properties.

Posted by ChUIMonster on 25-Feb-2009 12:57

I have carefully read the referenced documentation yet I remain frustrated.

I already knew about SwapRowsAndColumns() and it sounds like the perfect thing for getting data from rows in a table in the style that I need. So it was good to see that confirmed.

IncludeColumn() was a bit frustrating. The column name as a string option doesn't seem to work at all and the column number option results in odd errors. Then I realized that the variation with System.Data.DataColumn would just take a TT.fieldname. That compiles and it seems to make sense but it still doesn't work. The chart displays but it looks to me like all it is doing is charting the row# vs the row# - 1.

Which is no different than what it was doing.

Unless I'm missing something SetRowLabels & SetColumnLabels are methods that expect an array of strings -- not properties that let you specify a column in a table.

So far the IF forumns are not revealing anything useful. I had already found a few tidbits but nothing that actually works

This is where my driver code stands:

Posted by ChUIMonster on 25-Feb-2009 13:31

This:

obviously does not do what my addled mind was thinking that it was doing

Obviously it resolves to an integer rather than a System.Data.DataColumn.

Posted by Håvard Danielsen on 25-Feb-2009 13:54

I think you understand far more than you realize. The problem is that the UltraChart does not work with a BindingSource. I believe this was discussed in the old threads referred to initially in this thread.

If you look more closely in the samples we shipped you will see that we used a DataTable as the datasource in all the chart samples.

I tried your sample with a DataTable and it works fine.

I copied the DataTable method (with two parameters) and the NetType method from the DataServices.DataService in the samples into the code as well as the USING statements from this. (I removed your IncludeColumn calls).

I then passed your query to the DataTable method as follows.

ultraChart1:Data:DataSource = DataTable(qc,"").

I tried to paste the code in here, but the use of brackets conflicts with the hyper links for this editing tool...

Posted by Håvard Danielsen on 25-Feb-2009 14:08

I removed your x column from the chart as follows:

myCustChart:ultraChart1:Data:IncludeColumn( 1, false).

Posted by Håvard Danielsen on 25-Feb-2009 14:20

I've attached a code sample to the other thread:

http://www.psdn.com/library/thread.jspa?threadID=15560&tstart=0

Posted by resperger on 30-Sep-2011 05:15

The problem is that the reference to to threadID=15560 does not work!

Is there a way to access this one still?

This thread is closed