live real time chart

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
aryan110
New php-forum User
New php-forum User
Posts: 2
Joined: Fri Apr 02, 2021 6:13 am

Fri Apr 02, 2021 6:18 am

hi , how can i refresh this PHP code without reloading the page to display the latest chart price ?

Code: Select all

        <?php
		
			$data = file_get_contents('candlestick-chart-data.json');
			$schema = file_get_contents('candlestick-chart-schema.json');

			$fusionTable = new FusionTable($schema, $data);
			$timeSeries = new TimeSeries($fusionTable);

			$timeSeries->AddAttribute("caption", "{ 
											text: 'Apple Inc. Stock Price'
										  }");

			$timeSeries->AddAttribute("yAxis", "[{
												  plot: {
													value: {
													  open: 'Open',
													  high: 'High',
													  low: 'Low',
													  close: 'Close'
													},
													type: 'candlestick'
												  },
												  format: {
													prefix: '$'
												  },
												  title: 'Stock Value'
												}]");
						
			// chart object
			$Chart = new FusionCharts("timeseries", "MyFirstChart" , "700", "450", "chart-container", "json", $timeSeries);

			// Render the chart
			$Chart->render();

?>
nomanic
New php-forum User
New php-forum User
Posts: 1
Joined: Fri Apr 02, 2021 11:17 am

Fri Apr 02, 2021 11:20 am

You could do this with javascript easily
User avatar
hyper
php-forum GURU
php-forum GURU
Posts: 1222
Joined: Mon Feb 22, 2016 5:52 pm

Thu Apr 08, 2021 11:47 am

Make pages work without JavaScript first.

no need for JavaScript

HTML was able to do this before JavaScript was thought of.

Code: Select all

<meta http-equiv="refresh" content="3;url=https://www.mozilla.org">
Just be sensible in its use.

So long as your page doesn't take too long to load, there should be little to notice. Then look to use AJAX to enhance.
aryan110
New php-forum User
New php-forum User
Posts: 2
Joined: Fri Apr 02, 2021 6:13 am

Fri Apr 09, 2021 6:54 am

thanks for answering but i did not explain it well here , so i asked my question completely in this site : https://discuss.jsonapi.org/t/updating- ... chart/2190
User avatar
hyper
php-forum GURU
php-forum GURU
Posts: 1222
Joined: Mon Feb 22, 2016 5:52 pm

Sat Apr 10, 2021 8:11 am

Ok, here's more information on AJAX for you http-equiv works so long as your page is quick at loading.
Post Reply