The reason I apply Boost.js is exporting CSV file with big data as well as improving the performance.
I have a problem when using boost and the number of series more than 9. The barchart displays incorrectly. Therefore I try the workaround approach by increasing the the threshold to deactivate the Boost. It's also cause of CSV exporting possibility which I really concern.
Do we have any official update about this problem from the Highcharts Team?
First of all, boost is not available for bar charts (https://github.com/highcharts/highcharts/issues/6602). Solution to this inconvenience is to set type of chart to 'column' and invert it.
chart: {
type: 'column',
inverted: true
}
API Reference:
http://api.highcharts.com/highcharts/chart.type
http://api.highcharts.com/highcharts/chart.inverted
Example:
http://jsfiddle.net/obx1pbkw/
Related
I am trying to export a large feature collection from GEE. I realize that the Python API allows for this more easily than the Java does, but given a time constraint on my research, I'd like to see if I can extract the feature collection in pieces and then append the separate CSV files once exported.
I tried to use a filtering function to perform the task, one that I've seen used before with image collections. Here is a mini example of what I am trying to do
Given a feature collection of 10 spatial points called "points" I tried to create a new feature collection that includes only the first five points:
var points_chunk1 = points.filter(ee.Filter.rangeContains('system:index', 0, 5));
When I execute this function, I receive the following error: "An internal server error has occurred"
I am not sure why this code is not executing as expected. If you know more than I do about this issue, please advise on alternative approaches to splitting my sample, or on where the error in my code lurks.
Many thanks!
system:index is actually ID given by GEE for the feature and it's not supposed to be used like index in an array. I think JS should be enough to export a large featurecollection but there is a way to do what you want to do without relying on system:index as that might not be consistent.
First, it would be a good idea to know the number of features you are dealing with. This is because generally when you use size().getInfo() for large feature collections, the UI can freeze and sometimes the tab becomes unresponsive. Here I have defined chunks and collectionSize. It should be defined in client side as we want to do Export within the loop which is not possible in server size loops. Within the loop, you can simply creating a subset of feature starting from different points by converting the features to list and changing the subset back to feature collection.
var chunk = 1000;
var collectionSize = 10000
for (var i = 0; i<collectionSize;i=i+chunk){
var subset = ee.FeatureCollection(fc.toList(chunk, i));
Export.table.toAsset(subset, "description", "/asset/id")
}
I am working on an agent-based model and now I'm trying to experiment with CompareRuns.
when I execute the experiment, it should simulate the model several times and after each simulation, a dataset of sample data should be filled.
there is also a state chart in Main agent and each state has a traceln("..."). so after passing through each state, something must be printed.
the problem is that neither the print commands return anything, nor the dataset in which I store my data returns anything but zeros.
P.S.: I also have a GIS map in my model. could that be the reason for misbehaving of Anylogic?
I found the problem and fixed it.
check and double check all the "Parameter"s in the Main agent and make sure they all have different names and labels. the problem was that two parameters had same labels and it messed up the whole experiment.
I fixed the labels and the default value of all parameters, deleted the CompareRun experiment, made a new one and it worked.
Is there a way to update a chart based on the user input on text field? I'm not familiar with both Swing and JFreeChart but I need to virtualize some data. So far I'm able to display simple graph but only with hardcoded data.
Thank you
Yes, of course that is possible. First of all, I recommend looking at Scala-Chart which is a nice wrapper around JFreeChart.
JFreeChart lets you alter and update any parameter. For example if you have a data-set, you can clear it and add new data, you can readjust the axes, etc. Here is an example from a project I'm working on, where a "series" (JFreeChart speak) is removed from a "dataset", then a new series is calculated and added again:
https://github.com/iem-projects/sysson/blob/70829bf80ad22dfc0b6020e00dd07397b100e401/src/main/scala/at/iem/sysson/gui/impl/PlotChartImpl.scala#L222
I have a series of mutations to make on my Immutable.js map.
At what point should I prefer using withMutations rather than creating intermediate immutable maps?
From the Immutable.js docs:
If you need to apply a series of mutations to produce a new immutable
Map, withMutations() creates a temporary mutable copy of the Map which
can apply mutations in a highly performant manner. In fact, this is
exactly how complex mutations like merge are done.
But, where is the line? If I need to make two mutations should I use withMutations?
You should use withMutations when you want to group several changes on an object.
Because each change creates a clone, several changes in a row cause several clones. Use withMutations to apply several changes then clone once at the end. A clone at every step means that you are reading the entire list for each change, which makes it an n^2 operation. Using the mutatable version leaves it at just N.
This can create a massive performance hit if you just start doing things willy nilly like the other answer suggests. The kicker is it might not matter on a small test of data, but what happens if you push it live and then do a large scale operation on an array with 300,000 pieces of data instead of your test data which only has 100 elements. In your test data, you did 10,000 copies of which you might not notice. In production you would do 900,000,000,00 copies which might light your computer on fire (not really, but you would freeze the tab).
I wrote a demo demonstrating the performance difference http://jsperf.com/with-out-mutatable
I've also been trying to decide when it's best to use withMutations vs not. So far I have always been using withMutations when I need to loop through a list of items with unknown size n, and perform n mutations on a single map.
Example:
updateItems(state, items) {
return state.withMutations(state => {
items.forEach(item => {
state.set(item.get('id'), item);
});
});
}
What I wanted to know, is if I should use withMutations on a smaller known set of updates, or if I should just chain set.
Example:
setItems(state, items, paging) {
return state.set('items', items).set('paging', paging);
}
Or:
setItems(state, items, paging) {
return state.withMutations(state => {
state.set('items', items);
state.set('paging', paging);
});
}
In this case, I would prefer to use the first option (chained set calls), but I wasn't sure of the performance impact. I created this jsPerf to test some similar cases: http://jsperf.com/immutable-batch-updates-with-mutations.
I ran batches of 2 updates and 100 updates, using an empty inital map, and a complex initial map, both using withMutations and just chaining set.
The results seem to show that withMutations was always better on the 100 update case, regardless of initial map. withMutations performed marginally better on the 2 update case when starting with an empty map. However, just chaining 2 set calls performed better when starting with a complex map.
I would just create intermediate immutable maps and then use some profiling tools to check if you actually have any performance problems with that approach. No need to do performance optimisations before you have performance problems.
As a rule of thumb I prefer to use existing functionality like .map, .filter etc. without any thought of withMutations. If there is a need to create a new List (or Map) where each element is mutated, I would first question that need and try to solve the problem using existing tools and functional programming style. If that is impossible, I would create a custom mutation with withMutations.
I have tried using a few different data grids (FlexiGrid, ExtJs Grid, and YUI DataGrid) and have found YUI to work the best as far as documentation and features available. However, I am having difficulty setting up the data source. When I try to set it up using JSON, it takes too long, or times out. I have already maxed out the memory usage in the php.ini file. There will be many more records in the future as well.
I need to select data to populate the grid based on the user that is currently logged in. Once this information populates the grid, I need each id to be click-able and take me to a different page, or populate information in a div on the same page.
Does anyone have suggestions on loading 25 – 50 records at a time of dynamic data? I have tried implementing the following example to do what I want: YUI Developer Example
I cannot get the data grid to show at all. I have changed the data instance to the following.
// DataSource instance
var curDealerNumber = YAHOO.util.Dom.getElementsByClassName('dealer_number', 'input');
var ds_path = + "lib/php/json_proxy.php?dealernumber='" + curDealerNumber + "'";
var myDataSource = new YAHOO.util.DataSource("ds_path");
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
myDataSource.responseSchema = {
resultsList: "records",
fields: [
{key:"id", parser:"number"},
{key:"user_dealername"},
{key:"user_dealeraccttype"},
{key:"workorder_num", parser:"number"},
{key:"segment_num", parser:"number"},
{key:"status"},
{key:"claim_type"},
{key:"created_at"},
{key:"updated_at"}
],
metaFields: {
totalRecords: "totalRecords" // Access to value in the server response
}
};
Any help is greatly appreciated, and sorry if this seems similar to other posts, but I searched and still could not resolve my problem. Thank you!
It's hard to troubleshoot without a repro case, but I'd suggest turning on logging to see where the problem might be:
load datatable-debug file
load logger
either call YAHOO.widget.Logger.enableBrowserConsole() to output logs to your browser's JS console (i.e., Firebug), or call new YAHOO.widget.LogReader() to output logs to the screen.
Also make sure the XHR request and response are well-formed with Firebug or similar tool.
Finally, when working with large datasets, consider
pagination
enabling renderLoopSize (http://developer.yahoo.com/yui/datatable/#renderLoop)
chunking data loads into multiple requests (http://developer.yahoo.com/yui/examples/datatable/dt_xhrjson.html).
There is no one-size-fits-all solution for everyone, but hopefully you can find the right set of tweaks for your use case.