After adding the title, all are executed. Can I make the X-axis update every second according to the time, and the Y-axis random number 0~1?
Thank you for your patient teaching
Code: Select all
chart.events.load = HIFunction(jsFunction: "function(){setInterval(function(){this.series[0].addPoint([(new Date()).getTime(),Math.random()],true,true)},1000)}")
Is there a problem with the code ... The snippet I sent is responsible for that.The code can run normally, but the chart doesn't move. How can I write the function to run like in the movie?
Code: Select all
y = Math.random();
Code: Select all
y = Math.random() * 2 - 1;
Code: Select all
chart.events = HIEvents()
chart.events.load = HIFunction(jsFunction: "function () { var series = this.series[0]; setInterval(function () { var x = (new Date()).getTime(), y = Math.random(); series.addPoint([x, y], true, true); }, 1000); }")
Code: Select all
options.series = [spline]
if isButtonEnabled {
Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { timer in
let point = HIData()
let x = Date().timeIntervalSince1970 * 1000
let y = Float.random(in: 0..<1)
point.x = x as NSNumber
point.y = y as NSNumber
spline.addPoint(point)
}
}