How to set interval on an empty DateTimeAxis in a Silverlight toolkit chart - silverlight-toolkit

I have created a chart using the Silverlight 5 toolkit. It has LinearSeries without the ItemsSource specified (it is assigned later in code). The DateTimeAxis does not have a Maximum nor the Minimum specified as I might be plotting different data at different time. However, no matter what the data to plot is, I would like the points to be spaced out every 30 seconds. When specifying this in XAML the page fails to load (the system runs out of memory). When trying a different (larger) time interval it manages just fine (ex 1 month steps). It seems that if no data is provided to the graph it takes a 1 year interval as default.
Is this a known issue? What is the way to deal with this, other than specifying a Max/Min and then getting rid of it once some data is supplied?
Here is my code:
<toolkit:Chart Title="Live Use">
<toolkit:Chart.Series>
<toolkit:LineSeries
IndependentValueBinding="{Binding Time}"
DependentValueBinding="{Binding Value}"
AnimationSequence="Simultaneous" />
</toolkit:Chart.Series>
<toolkit:Chart.Axes>
<toolkit:DateTimeAxis Orientation="X" Location="Bottom" BorderThickness="2" Title="Time" ShowGridLines="True" IntervalType="Months" Interval="3"/>
</toolkit:Chart.Axes>
</toolkit:Chart>

Apparently this is a bug in the toolkit chart. I found this link which confirms this: http://forums.silverlight.net/t/101287.aspx. The problem is that the chart by default has its range set to 1 year. Now, if you try to set the interval to 30 seconds it will attempt to generate a lot of labels and this will slow it down up to the point where it runs out of memory. Solution is to manually set the range or to specify the itemsSource prior to specifying the interval on the axis.
Hope this helps.

Related

Missing values show broken line in Lens

I have an application that dumps statistics once every minute into ElasticSearch. Using Kibana, I've created a lens to visualize the values over time. All good.
Occasionally, the application skips a dump (which is a separate issue I'll be working on), so I may have occasional missing values. In the Lens, the Line chart breaks the line when a value is missing for a certain time (see screenshot).
How can I interpolate between the available values and show a continuous line instead?
EDIT
To make it clear, I'm asking how to fix the chart in the Lens. The issue of skipped dumps is a separate one and needs to be addressed separately. I may still have some missing values (unlikely but not impossible), and I would like my Lens to show a continuous chart anyway.
UPDATE
While I found the "Missing values" setting in "Visual Options" and I set it to "Linear", the interpolation is rendered with a dashed line. How can I make it the same as the main line?

How to plot only within a range defined by x number of bars?

I understand that I can contingently plot on the chart using range of date and time values.
However, I would like to be able to plot using a specific number of candlesticks.
For example, I would like to be able to say something like
// Within the most recent 10 bars
// If close[0] > close[1]
// plotshape()
I have tried implementing numerous variations using barstate.isrealtime or barstate.islast but I keep running into limitations.
One major problem is that, although bar_index[#] works by indexing backwards from the most recent bar, the value of bar_index[10] is not 10 but some number in the thousands (depending on the timeframe of the chart — for me its Daily = 2,616 candles, 1hr = 6,217 candles, 15m = 5,222, etc.). In other words, it counts the number of bars from the oldest bar available.
Since referencing of the bars (starting from most recent) and the index values (starting from the oldest) are conflicting--due to counting from opposite ends--I am not sure how to specify: plotshape() for the most recent 10 bars.
I am also running into trouble due to the fact that bar_index[0] occurs every single iteration of the chart's timeframe--so I am getting caught in recursive calculations when trying to do bar_index[0]-bar_index[10].
It seems that what I need is something like bar_index.islast[10]
The reason that I would like to call a plotshape() based on the number of specified candles versus since x date/time (or within date range (x,y)), is because I want my indicator to function properly regardless of which timeframe my chart is displaying:
If I am showing a monthly chart, I want to plot across the last 10 monthly bars; If I am showing a daily chart, I want to plot across the last 10 daily bars; etc.
If I am forced to use a date range, then this functionality breaks down, since I will be shown increasingly more bars for smaller timeframes.
Caveat**
I am able to kinda make this work by specifying the number of bars from the oldest candlestick by stating something like:
bar_index > 2600 ? color=color.black : na
However, given the fact that every single time frame displays a different number of bars, this is not a workable solution for me.
Thanks for any advice.
UPDATE
I have been hunting around and and found that the functionality I desire is already built into the show_last argument of the various plot()functoins.
Ill leave my question posted, in case it helps someone else.
UPDATE I have been hunting around and and found that the functionality I desire is already built into the show_last = int argument of the various plot() functions.
I'll leave my question posted, in case it helps someone else.

How can you watch gnuplot realtime data plots as a live graph, with automatic updates?

I plot a lot of graphs in gnuplot. These graphs are based onn sensor readings from around the solar power system.
Each graph has needed to be updated by typing something like
load "solar
where solar is a gnuplot program that performs the plot showing the condition of the 24 V (500Ah) battery bank and leaves it on the screen so I can do a regional screen capture for storage.
In this particular case, the numbers come in at 2-minute intervals. Unless the inverter is turned on, in which case they come in at 20 second intervals. So I end up typing that command a lot just to see how clean the signal is.
So the question came up as to whether I need to continue to tell it to load the program every time I want to see updates.
How can I actually make it automatically live?
Turns out it is as simple as can be to have it run live.
This article: Running Gnuplot as a live graph, with automatic updates
explains the process nicely.
Turns out that all you need to do is add two lines of code after the plot command. In my case, I want it to update the graph every 15 seconds, so the last two lines of the program are simply
pause 15
reread
Here is an excerpt from the article:
Gnuplot has some useful commands we can use:
pause
reread
These are fairly self-explanatory, so let’s make a Gnuplot file, liveplot.gnu, that refreshes itself once every second.
set xrange [0:20]
set yrange [0:400]
plot "plot.dat" using 1:2 with lines
pause 1
reread
We set the bounds of our graph, then plot the data from the file. using 1:2 means plot columns 1 and 2 as x and y, respectively. with lines means that the points are joined together rather than plotted separately. We pause for 1 second and then reread, meaning that the command file is re-executed.
It turned out to be so simple that I am going to add those two lines to all my graphs that I monitor on the xterminals of the individual Rpi3s that monitor the sensors.
Collected together on the big screen it gives me a great overview of the entire system, including temperatures and voltages and such.
The best part is that there is no need to specify the X range to be fixed. It is much better to let it recalculate every time it rereads.
Results: A true live graph, monitoring conditions of the sensors from which it is receiving near-real-time data.
(You can see how hot the panels get even on a relatively cool day, and how the MPPT charge controller works to maintain the voltage)
https://www.SDsolarBlog.com/montage

forecasting with regression in asp.net chart

I am refering to the official asp.net tutorial http://msdn.microsoft.com/en-us/library/dd456655.aspx . What i did is,,, in an fresh asp.net website, i added a chart control from the toolbox and dragged a table it to from my database. The problem starts now when i added a button and put the forecasting code in the button click event. The code is:
Chart1.DataManipulator.FinancialFormula (FinancialFormula.Forecasting, "2,40,true,true", "Series1:Y", "Series2:Y,Series3:Y,Series3:Y2");
The error message i got is
Forecasting Error – There are too few data points for this regression
type. A minimum of 2 data points are required.
In the chart, i selected "date" as x-axis, and "some number" as Y-axis... And what is this minimum of 2 data points required...
Can anyone help me out with this error.......
This question is a bit old, but I ran across this same situation today and wanted to post my resolution.
This "Too Few Data Points" issue occurs when the the trend line is added before the chart is bound. Simply moving the Financial Formula code below where the data is bound will resolve the issue. (Of course, if you have less than 2 data points in your binding, this won't help you).
Basically, until the chart is bound, the "input series" doesn't actually have the data to be used by the Chart's DataManipulator.
For predicting the future values at least two past values are needed,so if the result contains only one value it will throw error,because it is not possible to compare the values.The series in the chart should have minimum 2 values

flex chart annotationElement incorrect data points

I have 2 Y-axis on the chart and I am trying to use annotationElement's localToData to get the data points associated with a Point on the chart.
The annotation Element is able to return a set of values for the point ( 1 Y - data, 1 -x data), But it is returning the values against one axis and not the other.
Is there a way to associate the annotation element with a specific axis ?
Sorry, this is more of a Flex issue which I did not fully understand at the time of posting.
At that time, My plot series was associated with right axis and hence I felt there was coding error on my end when i called localToData.
Anyway, there is a bug in Flex PlotSeries localToData method that shows up only if you have flex debugger installed.
The bug is a Null Pointer exception on Plot Series code while trying to get filtered data.

Resources