Updating Highstock chart points - highcharts

I need to update the most recent candle in my chart. Typically, I would use this to update a point:
//javascript
chart.series[0].data[n].update({...});
However, my series.data array is empty when I show the entire data set possibly because of:
Official HighStock Documentation: data
Read only. An array with the series' data point objects. In case the series data length exceeds the cropThreshold, or if the data is grouped, series.data doesn't contain all the points. It only contains the points that have been created on demand. In these cases, all original X and Y values can be read from series.xData and series.yData. Additionally, series.options.data contains all configuration objects for the points, whether they be numbers, arrays or objects.
Returns Array
How can I update my most recent candle point when the interface to the Point.update method is only accessible via the series.data collection? When my series.data array is empty do I just overwrite the point properties via series.options.data?
I've also considered invoking the series.update(options) method, but I may need to perform a candle update many times as a result of real time activity. Therefore, an update on the entire series object would not be a good decision because of overhead.

The data array is empty because Highstock does data grouping - when enabled it uses groupedData array instead. Unfortunately, you cannot update a grouped point (Highcharts throws the error).
What you can do, is disabling data grouping, then you will get a data array and point.update is possible or use Series.removePoint and Series.addPoint()
chart.series[0].removePoint([chart.series[0].groupedData.length - 1]);
chart.series[0].addPoint([
Date.UTC(2016, 11, 8),
115,
2,
30,
20
]);
example: http://jsfiddle.net/0z95x58t/

Related

How to update individual array element in firebase with iOS Swift?

Here i'm using firestore query to update, insert data. How to upadate dictionary of array value to firebase database.
here is my firestore data structure:
Right now able to get data of slot1 -> 0th position value in a model class.
how can i update value of slot1 0th position of isbooked boolean value alone, without affecting remaining values and other slot.
You can't without reading the entire document, modifying the array data in memory, then updating the entire array field back out do the document. The smallest unit of change in a Firestore array field is an entire field. You can't make smaller changes to individual elements of a field, except those defined by arrayUnion and arrayRemove (which are not compatible with what you're trying to do here).
You can do that by getting the exact id of your structure ..
Database.database().reference().child("SlotName").child(yourAry.key).child(yourAry.key).child("isbooked").setValue(true/false)
Manage your database structure accordingly, its just an example and as user Doug suggested have a look on docs too ..

Core Plot Reload Data

Beginner in Core Plot,I'm trying to plot real time graph using core plot where the data comes every 0.3 second and I am plotting for about 1 hour duration. Now every time when the reload data method is called does core plot start plotting the graph all over or only the newly appended point in the datasource is considered?What I am targeting is only the newly appended point to be reloaded to be plotted on the plot and the rest points in datasource already plotted without reloading.
You have several options for updating the plot data:
-reloadData: Queries the datasource for all of the data points.
-insertDataAtIndex:numberOfRecords:: Insert records into the plot data cache at the given index. The datasource is only queried for the new data. Use a starting index equal to the old data count to append records to the end of the existing data set.
-reloadDataInIndexRange:: Refresh only the data points in the given range.
-deleteDataInIndexRange:: Removes existing data int the given range.

Crystal Report 11-Chosing a value from a slice of the pie

Hi I have a pie chart with 8 slices in crystal report 13, I want to chose the maximum value among the slices so I can use it in a text narrative. Eg The share of the segment xx is the highest by #maxsegshare among all other segment shares.The #maxsegshare should capture the highest value among the slices in the pie chart. I have no idea whether it is possible? If it is could some one throw some light on it.
Cheers.
Try to create another query, with SELECT MAX(some_field) ..., then fill a variable to be used in other chart.
in this case you need to store all summary values in a array and pick the max of the array and diplay in saperate variable.
When you are summarizing the data.. add the following code.
Shared Stringvar Array store;
store:=store+ ToText(Summarized value);
1
Now when you display, create a formula and write below code
Shared Stringvar Array store;
Maximum(store);

Get Range of Cells Value as Display using Microsoft.Office.Interop.Excel

I am programming with C# to access data from a range of cells in Excel Spreadsheet.
I can use the following code to access and return the values of range of cells into an object array.
(object[,])Mysheet.UsedRange.get_Value(XlRangeValueDataType.xlRangeValueDefault);
However, I like to find a mean to return all data as strings (exactly as shown on the spreadsheet) into a string array or putting the values as text into the object array. Are there any mechanism to do that>
Did you try using .Text in the Range object? As far as I know, you will have to iterate over each cell and do it for each of them.
Note that .Text is considerably heavy in terms of performance compared to Value or Value2.
And also note that it is also tricky, .Text returns the text as you would see it if you had Excel visible, so if you have a huge number in a column with a short width what .Text will give you is a lot of ####
Sadly I can't think of another way to get it. Usually I get the raw values and format them properly once a get them all, but that assumes that I know which format is used in which cells.

save coordinates for graph in table and then remove them in random order? best approach to do this?

I have a situation and it goes like this:
I need to print out coordinates like the one's used in a maths graph. So (0,0) (0,1) (0,2) and so on. So if the length is specified as 10 and breadth is specified as 20 then the graph region will be all the points from (0,0) till (10,20).
I wish to store these values in a table so that these can be printed out in order.
Later on, there is a scenario that some of these values will get removed so suppose the values removed are (4,5) (4,6) (4,7) and then the main table that was created earlier should not contain these values. And I need to be able to print out the new table with the remaining values.
Till now I have only done the coding to ask for the length and the breadth values.
How should I go ahead with the rest of this?
In case you need any clarification or the question if too confusing then please leave a comment and I will try to make it better.
Any help will be very highly appreciated.
Thank you
There are a few ways of doing this depending on what you want.
The easy way is to use an array of arrays like this:
a = Array.new(11) {Array.new(21) {0}}
This creates an array like a[0][0] to a[10][20], with every item initialized to 0.
To remove an item, set it to nil:
a[4][5] = nil
When you print the array, skip any nil values:
for x in 0..10
for y in 0..20
next if a[x][y]==nil
puts a[x][y]
end
end
If your graph is very large, read about a "sparse matrix" which is how tools like Excel store many cells using less RAM for blank cells:
http://en.wikipedia.org/wiki/Sparse_matrix

Resources