Iterating through array of objects, populating BarChart, and saving each as image - actionscript-3

I am creating an option in my application to create a PDF report based on the results from the application.
The results are represented as an ArrayCollection of XMLList objects, which I am using to populate a BarChart.
To create a screenshot of each result (as a PNG), I am loading the Results Window (a Title Window) and hiding it (visible = false). I am using AlivePDF to add the capture to a PDF report.
I have been using a Timer to iterate through the results, load each result to the chart, create a delay, and then capture the image and add it to the report.
I am now questioning my strategy and I was wondering if anyone has a suggestion as to any other possibilities.
I thank you for your help in advance.
P.S. I am not creating a client/server application. I need to create the images on the client side.
UPDATE
Sorry about the confusion with my question.
Currently, I am able to iterate through the results (using the Timer), but the chart does not refresh properly before capturing the screenshot and saving as PNG.
Essentially, I am trying to see if there is any other possible solutions for iterating through the results and creating a delay so that I may be able to load a result to the chart, capture the screenshot, and add it to a PDF. Is there any other way to do this in Flex?
Initially, I was thinking of iterating through the results array using a for loop, but this was not working due to the fact that the results were not loading in time before capturing the screenshot of the chart.

Once you set the chart's data it should eventually display the updated information. However the time taken will vary upon any number of factors so your best bet is to find out what event the chart dispatches once it updates. You may at that point want to capture the PNG as a callLater just in case you need an extra frame before the visual aspects are updated.
That said, this seems like a heavy-handed solution begging for an alternative.

Related

Foundry Workshop or Quiver - Aggregation editable by user in view mode, is it possible?

Is it possible in Workshop or Quiver to expose an aggregated bar chart where aggregation property is changeable by user (in reading mode). For instance by offering to user a dropdown that lists properties to aggregate on.
I guess the function presented in this thread can do the job. And then it should be a story to create dropdown widget and chart plugged on the function result. But I miss experience in Workshop or Quiver. Can some one help me with more detail ? Thank you by advance.
I want to move from Slate to Workshop/Quiver applications without loosing this feature.
One approach is to use a Function-backed chart and the approach you linked to.
Another option is to change your data structure to a "metrics"-style schema like:
|id|main_object_foreign_key|type|timestamp|value
And then make a chart based on filtering on the metric type property with the series also set to the Type value.
This effectively lets the user control what "metrics" to show on the chart by providing them with a filter element.
There are some downsides with this approach, but adding a representation of your data in this format can bring a lot of flexibility to certain kinds of visualization or workflow building needs.

How to determine number of records on a socrata table

Is there a way to determine how many records are available to download for a socarata table?
I'm using the API endpoint routines. I can down the file but it would be nice to know how many records are available to download before starting a download.
If I understand the question right, the most straightforward way would be to view the source dataset.
Example: https://data.cityofchicago.org/Transportation/Transportation-Network-Providers-Trips/m6dm-c72p
Screen clip of "What's in this Dataset?"
Screen clip of more precise count from the bottom of the data preview grid
However, you can also do it through the API.
Example: https://data.cityofchicago.org/resource/m6dm-c72p.json?$select=count(*)
[{"count":"100717116"}]

Firebase Analytics - Open and Closed Funnel Tracking

I have been reading a bit about Firebase Analytics now, and because it is mostly an event-based data model, I assume one can not do screen tracking directly?
I was wandering whether one should then just pass the screen type/name as part of the event's parameter, or possibly as a user property (which I believe is a simpler way of calling custom dimensions) ? Thus all events that are fired on the 'Home' screen would have: content_type_Home=1 ?
Does someone have an answer for me, as well as a code example please ? Much appreciated :)
Until Screen Tracking and User Flows become available, the closest alternatives are :
To log a distinct event for each screen (e.g. "welcome_menu") and to use a Funnel to visualize the flow through a sequence of connected screens.
To log a single event (e.g. "screenview") and add a parameter that identifies the screen itself. Note that, since Funnels don't allow you to specify event parameters, you would only be able to view reporting on this through BigQuery at the moment.
To add on to Steve's answer: note that since Firebase only provides "open" funnels, this technique only works for a flow where users are forced to go from one screen to the next.
If a screen can be accessed from outside this particular flow, your funnel visualization will be messed up - since the number of users from within that flow and outside of it will be added together, potentially creating a conversion rate of more than 100%.
(That makes open funnels pretty useless IMO, except for very specific use cases.)

Django - Dojo/Dgrid - how to manage LARGE data sets

6.30.15 - HOW CAN I MAKE THIS QUESTION BETTER AND MORE HELPFUL TO OTHERS? FEEDBACK WOULD BE HELPFUL. THANKS!
I am developing a web application that will handle/manage a VERY LARGE data set - Currently any kind of heavy load causes the browser to lock up - whether I'm in the Django Rest Framework API or in the Dojo/Dgrid. This is kind of a dual question.
I've researched and can't find a clear way to do this on either side.
How do I limit how much the database sends at one time to the Django Rest Framework and/ or The Dojo Dgrid. The Dgrid pulls the data from the Django Rest API. The DRF pulls data directly from the MySQL database.
If I can control how much data is sent at one time, then hopefully it won't lock up the browser as much. ANY suggestions, advice, help, examples would be very helpful. Thanks in advance!
UPDATED 6.22.15 -
Alright, I FINALLY Got the pagination to work and it display the limit/offset in the headers. :) YAY!!!! I can also see the data in the Response headers. HOWEVER... the grid won't populate and I keep getting this odd error:
TypeError: transform(...) is null
return transform(value, key).toString();
instrum...tion.js (line 20)
I've gotten this error before, but I've never been able to find a solution to it. After researching, there's not much I can find on HOW to fix or really even what it is. Any help with this would be greatly appreciated!! I'm SO CLOSE to getting this thing to work correctly after WEEKS and WEEKS of beating my head against a wall. Please help! :) Thanks in advance!!!
2nd Update - This was an answer from a previous post - but I'm still not sure how to fix it. When I addressed another issue - it went away for awhile, but I still have no idea how to correct the issue.
Problem 3: "transform(...) is null return transform(value, key).toString();"
This sounds largely tangential to the original issue, but the most common cause is a widget template that is referencing a property via ${...} that doesn't actually exist in the widget.
I don't know how to answer this on the layer between DRF and the database, but as discussed in other SO questions like this one, DRF allows you to limit the amount of data sent with requests via page or offset/limit parameters.
Based on the phrasing of your question, it sounds like the client side is actually requesting too much data. I'll outline how the flow should work, so hopefully you can spot what you've missed:
A dgrid instance is set up with a collection referencing a dstore/Rest instance
The dstore/Rest instance is created with appropriate properties set. In this case, based on the DRF Documentation:
useRangeHeaders: false (this is already the default)
rangeStartParam: 'offset'
rangeCountParam: 'limit'
As a result, when the grid renders, you should see requests sent to your server e.g. endpoint?offset=0&limit=25 - if you don't see those two parameters, that would be why you're getting too much data
The server will need to query the database with the respective OFFSET and LIMIT
The server must provide a response with the expected number of items (except if it reaches the end of the data set first, which should be reflected by the total property in the response, presuming the customization in the previous SO answer I linked is used)
Ultimately, if the service is working as expected, the grid should only be requesting a handful of items at a time, and should only be firing one or two requests at any given time.
Would add as a comment, but not enough reputation at the moment ....
Your question is pretty general, but one strategy would be to allow the user to select the number of items they wish to view at a time and then allow the user to page through the data with 'next x items' and 'prev x items' buttons. Your data object query would then use the current position +/- 'x' as the index range to reduce the number of data objects sent to the browser. This is the basic flow for Ebay, Amazon, Google, or any site with thousands of items to display. The 'next' and 'prev' actions could be wired as POST requests.

SSRS Word Clouds

We are currently integrating with SQL Server Reporting Services and have got most of the functionality we require in place now but I am stumped on how do get the last bit working. On the current manual system at the bottom of the Excel spreadsheet is a Word Cloud which we would like to emulate in SSRS. I have constructed a DataSet that returns a list of words and their scores but I cannot work out how to create a word cloud from it.
I have followed the example below and got it working successfully and it looks great in Visual Studio but when I look at it in Excel and as a PDF its just not very nice at all.
http://www.sqljason.com/2012/03/making-tag-cloud-with-ssrs-rich-text.html
The main problem is that the results are loaded into a table (that has to be shrunk so it is unobtrusive) the some VB generates the HTML that is then rendered in a Text Area.
When I look at it in Excel the table is clearly visible (its huge) and in PDF form it is missing.
Does anyone know of an extension or plugin that I could use to display the word cloud or a better way of doing it?
The alternative would be to embed it as an image and call a web-service that creates the word cloud on the fly but it does seem like a lot of work for something that is probably a fairly common requirement.
Thanks everyone in advance :)
You say it does not look nice and then that it is missing. Which one? Why are you having to use a Dataset for words generated? If they are just arbitrary words you could set them up in free floating text boxes. I am not getting why to generate text you need to apply a dataset to it unless there is an object like a 'list' you have rules that you HAVE TO use a dataset.
Without a picture (which you do not have enough points to show) it is hard to tell what the cross applicatin problem could be. You are using a blog as a basis which the person could be using 2008R2 or 2012 SSRS for as well which makes it hard to troubleshoot.
My guess is you are applying a boxing layer, positioning or overlay that the PDF renderer does not like. My suggestion would be to start a small report with just his example only and see if it works as is in 2008. He seems to have someone mention on an issue of positioning which is the biggest culprit of problems with SSRS and multi format saving. If you can get the CORE part of your report working as he described I would think you may be able to use that as a 'subreport' inside of another report if you want more than one object to a report.