Two jQuery Mobile sliders working together - jquery-mobile

I want to have 2 sliders in a JQM site which affect each other.
Slider 1 will change the number of months
Slider 2 will change the cost
Behind the scenes, there will be an amount, say $3600
By default, the number of months slider will be 36, therefore the cost slider would be $10
If the user changes the months slider to be 18, the cost slider should auto-change to $20 (since 20 * 18 = £3600)
Likewise, if the user changes the cost slider to $20, the months slider should move to 18 months.
I added a bind("onchange") to both sliders but ended up with a "Maximum callsize stack exceeded" error.
I have tried using event.originalEvent and event.preventDefault but to no avail.
How would I go about getting these 2 to work with each other so that if 1 is updated, the other also recalculates and vice versa?
Thanks

The refresh seems to be the thing that triggers the change event so now I die() the event before calling refresh, then create it again
$("#Months").val(42);
// remove binding
$("#Months").die("change");
$("#Months").slider("refresh");
$("#Months").live("change", ChangeMonths);
Seems to work, maybe not pretty but oh well

Related

Show Minutes as Intervals on the horizontal scale in TradingView Lightweight

is it possible to show minutes instead of a day in the lightweight chart? in swift the CandlestickData accepts time in timestamps, however it only displays the day
thank you
the CandlestickData accepts time in timestamps, however it only displays the day
Lightweight charts will show a bar for every data point that you supply, it doesn't matter if it is at a day resolution (interval) or at a minute interval or anything else.
If you give it 100 bars then it will show 100 bars.
With regards to the time scale. You can set options to change how the timestamp is displayed. See the options here: https://tradingview.github.io/lightweight-charts/docs/api/interfaces/TimeScaleOptions
You are probably interested in this property:
https://tradingview.github.io/lightweight-charts/docs/api/interfaces/TimeScaleOptions#timevisible
you can set this options within the createChart options or via the applyOptions api method. Similar guide here: https://tradingview.github.io/lightweight-charts/tutorials/customization/chart-colors#applying-options

How to look back a certain number of days for an indicator and how to only calculate logic upto the last complete bar (i.e. not the current bar)

I'm relatively new to Pine and was having trouble with a couple of things.
So I've got a indicator that I want to look back for the last 5 full days of activity, however not each stock trades in the premarket/afterhours so I want to be able to look back say 5 days and then calculate the number of bars on the time frame (i.e. for a 5 min or hourly resolution). That way I can calculate the number of bars present on the current ticker for that time frame and adjust my indicator length (instead of just having a constant figure of 80 bars or whatever).
The second thing I want to do is only have the indicator update on the completion of a full bar (for example the hourly resolution). So I want it to only calculate up to x-1 bars. Right now I'm finding that it's updating on each new tick. ( I was able to figure this one out, just changed it from i= 0 to length -1 to i=1 to length).
Any help is greatly appreciated.
Thanks,
A

How to increase time window for Jenkins TimeLine graph

In the Jenkins main page, I have a link called "Build History" that builds Timeline chart with the chronology of all builds. Link is:
http://myhost:8080/jenkins/view/All/builds
It looks like the following:
I use it a lot as I can see in one chart how many failures occurred.
My problem is that history starts at 2AM, I can guarantee I have a job execution every day at 1AM, and I can not see it here.
In the end I would like to have a least the last 24 hours each time, but I did not find any configuration menu for this. I don't even know if it's from a plugin I installed or native in Jenkins.
Does anyone know how to increase the time window ? (or give me an indication on where to search ...)
You are talking about the greyish window, not the table below, right?
This is a 2 part slider with a viewfinder at the top middle.
The lower (darker grey shade) part is in hours. It fits about 4.5 hours in the view.
The upper (middle grey shade) part is in days. It fits about 4.5 days in the view.
The top middle (lightest grey shade) part is showing on the upper (days) graph the relative position of the 4.5-hour window that you are currently viewing on the lower (hours) graph.
You can scroll the graphs either by clicking and dragging left/right, or by pointing the mouse there and using the mouse scroll. Since the lower graph is relative to the upper graph, the scrolling is linked too: you can scroll in large chunks using the upper graph, and scroll in smaller finer increments using the lower graph.
If you are having issues seeing anything on the lower graph, then look for little vertical bars on the upper graph (scroll if you need to). Position those within the lightest grey area in the middle (let's call it the "viewfinder"), and you will see a list of jobs in the lower part.
While I haven't seen a way to increase the default window from the default 4.5-hour view, you can easily scroll it left/right to view the past 24 hours.
You can scroll (Left/Right) the upper part in the below figure to see the history.

Highcharts suddenly shows less points

Up until now, my highcharts was working fine. I have about 7,300 data points and new data is added once every hour.
Before, when I first loaded the highchart, it loaded and displayed all of the data normally (each point was 1 hour apart).
Today, I noticed that it only displays a point until it's 12 hours apart unless you zoom in. Is there a setting in highcharts that filters how many points can be shown or something?

Shifting Chart without losing points

I want to shift a chart in another way than addPoint does. You can see what I mean in my JSFIDDLE: http://jsfiddle.net/Charissima/TEEdw/3/
When the chart has filled the container and the next point is added, it shifts to the left without losing the first point.
It works fine, but sometimes I can see the chart swapping a little bit. And even worth: when running over a longer time the chart gets lost. It still works, you can see it shifting and updating y in the upper right corner, but the chart is not visible any more. Even the navigator is empty.
So my question is: Is there a better and smarter way to shift the chart this way?
data.push([ xTime, prevY ]);
data.push([ xTime, y ]);
series.setData(data, true);
var faktor = ( (chart.xAxis[0].max - chart.xAxis[0].min) / 60 / 1000 ) * 200;
chart.xAxis[0].setExtremes( chart.xAxis[0].min + faktor, chart.xAxis[0].max + faktor);
I've been working on a chart with very similar attributes and have run into similar problems. One of the undesired effects of the addPoint() shift flag is that it tries to keep the data set the same size it was initialized with. I'm guessing that is your reason for not using it. It doesn't allow you to grow your data set to a certain size and then start shifting. I had this issue with the shift so I resorted to doing exactly what you are doing. I think this is the generally accepted alternative to addPoint().
But... couple that with the idea that Highchart (or maybe just Highstock) appears to have a max number of data points it will handle. I don't know if it is the same for all charts (or even for all users/browsers) but for me yours seems to disappear when the data count is 1000. See this fiddle: > jsfiddle.net/TEEdw/4/ you can watch the data length grow to 1000 and then the chart disappears. I was running into the same issue on my chart. My solution was more complicated due to other factors in my chart. But a simple solution is to monitor the data count and when it approaches 1000, switch to the addPoint() with shift method. See this fiddle: > jsfiddle.net/TEEdw/5/ There is probably other ways to allow the data set to grow and then shift at a certain point. But this one just used your existing code. You could probably dynamically set the shift flag based on data length and only set it true once the data reaches a certain length.
EDIT: Ok... there is also a plotOptions setting called turboThreshold (http://api.highcharts.com/highcharts#plotOptions.series.turboThreshold) that can be disabled. It defaults to 1000 (so that makes sense). Setting it to zero allowed your chart to keep going after 1000. See this fiddle: jsfiddle.net/TEEdw/6/

Resources