You must be logged in to post your query.
Home › Forums › Chart Support › Auto refresh Graph with some particular time duration
hi sir,
i am fetching records from database(SQL) & want to refresh page after some particular duration could please anybody help me?
hope you will help me
Thanks & regards
Mahesh.
You can simply render chart inside setInterval or setTimeout function, which renders the chart for every set duration. Please check this thread for more information.
__
Priyanka M S
TeamCanvasJS
Hi Madam,
Thanks for Your Replay..
I tried one code but it’s draw same chart over by over
please provide me a sample code which could be working properly
i am using ASP.MVC and SQL
This is my code:
var x = i;
var updateInterval = 1000;
var updateChart = function () {
for(var y=0; y < result.length; y++){
dataPoints.push({label:result[y].Head, y:result[y].ForgingStock});
}
x=y;
chart.render();
};
setInterval(function () { updateChart() }, updateInterval);
Thanks & regards
Mahesh.
Please take a look at this sample project, which updates the chart when dataPoints are added to the database. Also please refer the ReadMe.txt file present in the sample project for setup related information.
__
Priyanka M S
Team CanvasJS
Thanks for sending sample code
right now my problem has been resloved .
i have one more doubt how to remove water marks(trail vesion,canvas.com) from chart could you please help me?
Thanks & regards
Mahesh
Trial Version is for evaluation purposes for up to 30 days. To use charts without ‘Trial Version’ and ‘CanvasJS’ Credit Link you will need to have a Commercial Version of CanvasJS. Please contact sales@canvasjs.com for sales related queries.
__
Priyanka M S
Team CanvasJS
Thanks’s for your replay.
I have 1 view and want to give time intervel from database(Sql) dynamically not static
I have gave some particular time duration(5000) in database based upon that it should be updating the graph
Could you please help me?
I am using SQL and Asp.Net MVC
Thanks & regards
Mahesh
As of now, in the given sample project, chart gets updated whenever a new dataPoint is added to the database. If you are updating the database at a certain interval, the chart gets updated accordingly.
If this doesn’t solve your requirement, please brief us further so that we can understand it better and help you out.
__
Priyanka M S
Team CanvasJS
i need dynamic time refresh for example in database(sql) i have assign time interval (5000). Instead of giving time interval in html better to fetching from database
var update Interval =5000;(html)(static)
here i put 5000 as time interval i want time interval from database
i want to fetch time duration in SQL database
Tell me any idea for dynamic refresh time instead of static
Thanks & regards
mahesh
You can get the interval data from the database and assign it to a variable in the back-end(C#), then you can use the same variable in the front-end(HTML) with the help of inline expressions.
ex: var updateInterval = <%= variable_name %>;
Assigning this inline expression to updateInterval should work fine in your case.
__
Priyanka M S
Team CanvasJS
Thanks for your replay.
If you don’t mind could you please share me sample code in MVC
Thanking you
Thanks & regards
Mahesh
Hi mam,
graphs are not refreshing automatically with in a particular time duration if i try to update the data on database using asp.net mvc
If you need i can send my entire code and sample data
Kindly share a sample project(along with sample data) over Google-Drive or onedrive reproducing the issue you are facing so that we can look into your code, understand it better and help you out.
__
Priyanka M S
Team CanvasJS
Sure madam,
may i know how to share my project to you. I don’t know how to share
You must be logged in to reply to this topic.