Page 1 of 1

Advanced Charts / FREE amazing resource

Posted: 2020-05-14 04:10
by D Oliveira
Hello folks, here is a free, amazing & beautiful integration for your apps:

http://amcharts.com/demos/

click on a demo you like to see the code.

here is the ajax code to populate data from a db:

Code: Select all

<?php
	$currDir = dirname(__FILE__) . '/..';
	include("$currDir/defaultLang.php");
	include("$currDir/language.php");
	include("$currDir/lib.php");

	$con = mysqli_connect($dbServer, $dbUsername, $dbPassword);
	mysqli_select_db($con,$dbDatabase);


	$mi = getMemberInfo();

	$ajax_var = makesafe($_REQUEST['ajax_var']);

	$result = $con->query("select * from diary where user_name = '{$mi['username']}' and date_s = '{$ajax_var}'");

	$data_table = array();
	$outside = 0;
	$inside = 0;

				    while ($row = $result->fetch_assoc()) {

				                  unset($idx);

				                  $idx = $row['date1'];

				                  $idp = $row['amount'];

				                  
				                  $originalDate = $idx;
						  $newDate = date("Y-m-d", strtotime($originalDate));
								  

								  $data_to_be_inserted=array('date' => $newDate, 'value' => $idp);

									array_push($data_table, $data_to_be_inserted);

									$inside = $inside +1;
									$outside = $outside +1;


					}

					$outside = $outside +1;

					if($outside>$inside){
						echo json_encode($data_table);
					}



?>



Image
free photo hosting russia

Re: Advanced Charts / FREE amazing resource

Posted: 2020-05-15 01:39
by D Oliveira
in case an old date is to be added later on and mess with the order of the data:

Code: Select all


function array_sort_by_column(&$array, $column, $direction = SORT_ASC) {
    $reference_array = array();

    foreach($array as $key => $row) {
        $reference_array[$key] = $row[$column];
    }

    array_multisort($reference_array, $direction, $array);
}
	
	
	array_sort_by_column($data_table, 'date');
	echo json_encode($data_table);
	
	
	


Re: Advanced Charts / FREE amazing resource

Posted: 2020-05-16 11:45
by a.gneady
Awesome! Thanks for sharing this :)

Re: Advanced Charts / FREE amazing resource

Posted: 2020-05-19 14:31
by D Oliveira
a.gneady wrote:
2020-05-16 11:45
Awesome! Thanks for sharing this :)
no problem =)

if y'all wanna remove the logo in the free version use:

Code: Select all

chart.logo.height = -15000;
disclaimer: if your app generates revenue make sure to purchase the license and support the developers

Re: Advanced Charts / FREE amazing resource

Posted: 2020-07-11 19:35
by bruceholt
Hi,

I am trying to use the scrollable line chart but can't figure out where the first part of your code goes and what parts relate to different fields in the database and also where the second part of the code goes.

Hoping you may be able to help myself as well as others on here.

Re: Advanced Charts / FREE amazing resource

Posted: 2022-03-06 01:47
by SkayyHH
I saw your post here. I would like to have a chart under the table in the tv page. Please, which code do I have to use where? Have you done that already? Thanks very much!