New widget - Chart linked to SFL grid?

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
Bryan641
Profound User
Posts: 72
Joined: Fri Oct 01, 2010 5:07 pm
First Name: Bryan
Last Name: Leaman
Company Name: InVue Security
Phone: 704-752-6513 x221
Address 1: 15015 Lancaster Hwy
City: Charlotte
State / Province: North Carolina
Zip / Postal Code: 28277
Contact:

New widget - Chart linked to SFL grid?

Post by Bryan641 »

I'd love to be able to link my subfile grid to a chart such that when someone clicks on a column to sort, the chart would also update to show that column's values and sorted the same way.

Is there a way to achieve this effect now? Could you provide a chart that can be linked to a subfile? The chart labels would be taken from a specific column of the grid, but the values graphed would change when the grid columns are "clicked".

--Bryan
User avatar
David
Profound Logic Staff Member
Posts: 690
Joined: Fri Jan 04, 2008 12:11 pm
First Name: David
Last Name: Russo
Company Name: Profound Logic Software
Contact:

Re: New widget - Chart linked to SFL grid?

Post by David »

It may be difficult to create a widget for this, but the behavior you're describing could be implemented today with existing features.

You could implemnt server-side record sorting for the subfile -- see the grid's "column sort response" properties for details on that.

An easy way to sort the records on the server-side would be to use an embedded SQL query with an ORDER BY clause.

You can then bind the "names" property of the chart to a field that you can use to feed in the chart element names from RPG.

You can also bind the "values" property on the chart to feed in the value for each element.

Does this help?
Bryan641
Profound User
Posts: 72
Joined: Fri Oct 01, 2010 5:07 pm
First Name: Bryan
Last Name: Leaman
Company Name: InVue Security
Phone: 704-752-6513 x221
Address 1: 15015 Lancaster Hwy
City: Charlotte
State / Province: North Carolina
Zip / Postal Code: 28277
Contact:

Re: New widget - Chart linked to SFL grid?

Post by Bryan641 »

I'm aware that I could handle it server side, but the response time for this program isn't all that great, because it's consolidating and sorting tens of thousands of records into just a few lines in the subfile grid. I guess I could retain the work file in QTEMP and sort that & reload. It would be just a little bit quicker that rebuilding it totally.

But the client-side subfile sort is nearly instantaneous, and refreshing the chart should be just as quick in this case.

If the subfile grid were a standard table element I could write some javascript to read the label column and the currently sorted value column (as long as I can tell which column was clicked on), create a large string of comma-separated values and set the chart data names & values parameters. Can I get to the subfile grid data in javascript? Can I tell which column it's currently sorted by in javascript?

--Bryan
User avatar
David
Profound Logic Staff Member
Posts: 690
Joined: Fri Jan 04, 2008 12:11 pm
First Name: David
Last Name: Russo
Company Name: Profound Logic Software
Contact:

Re: New widget - Chart linked to SFL grid?

Post by David »

You can get (some of) the data from the grid using an API that we provide, but I don't think this will help you.

The grid widget in Profound UI uses virtual rendering, meaning that only the visible number of rows exist in the grid widget at any one time.

There is not currently a way to get at the other records using JavaScript.
Bryan641
Profound User
Posts: 72
Joined: Fri Oct 01, 2010 5:07 pm
First Name: Bryan
Last Name: Leaman
Company Name: InVue Security
Phone: 704-752-6513 x221
Address 1: 15015 Lancaster Hwy
City: Charlotte
State / Province: North Carolina
Zip / Postal Code: 28277
Contact:

Re: New widget - Chart linked to SFL grid?

Post by Bryan641 »

Sorry to resurrect this old thread, but I just wanted to point out that since you have sort capability on the grid columns, and an Excel export, you should be able to create a link from a chart to a grid to provide this functionality, since I can't get there with Javascript. I think this should be on your list of enhancements to implement, and even more so if it'd provide a way to handle multi-series charts without my having to code an RPGSP or other cgi-type program to generate XML.

--Bryan
User avatar
David
Profound Logic Staff Member
Posts: 690
Joined: Fri Jan 04, 2008 12:11 pm
First Name: David
Last Name: Russo
Company Name: Profound Logic Software
Contact:

Re: New widget - Chart linked to SFL grid?

Post by David »

We will certainly take this into consideration.

In the meanwhile, though, it is possible to do advanced charting without having to write a CGI program.

You can bind the "chart url" property to an RPG field so that a dynamic XML file URL can be used. A standard non-CGI program could be used to "author" the XML file, (you'd probably need to give it a unique name based on user + timestamp or something) and then feed in the path to this property using field binding.

The program could even delete the file when the user exits the screen.

The only restriction here is that the file must be placed somewhere in the document root folder of the HTTP server.

Creating XML files on the IFS through RPG is not too difficult if you have some good examples to go by.

If you are not familiar with using the IFS from RPG, I would reccomend Scott Klement's IFS API tutorial which can be found on his website.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests