Advanced Charts / FREE amazing resource

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
User avatar
D Oliveira
AppGini Super Hero
AppGini Super Hero
Posts: 347
Joined: 2018-03-04 09:30
Location: David

Advanced Charts / FREE amazing resource

Post by D Oliveira » 2020-05-14 04:10

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

User avatar
D Oliveira
AppGini Super Hero
AppGini Super Hero
Posts: 347
Joined: 2018-03-04 09:30
Location: David

Re: Advanced Charts / FREE amazing resource

Post by D Oliveira » 2020-05-15 01:39

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);
	
	
	


User avatar
a.gneady
Site Admin
Posts: 1281
Joined: 2012-09-27 14:46
Contact:

Re: Advanced Charts / FREE amazing resource

Post by a.gneady » 2020-05-16 11:45

Awesome! Thanks for sharing this :)
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

User avatar
D Oliveira
AppGini Super Hero
AppGini Super Hero
Posts: 347
Joined: 2018-03-04 09:30
Location: David

Re: Advanced Charts / FREE amazing resource

Post by D Oliveira » 2020-05-19 14:31

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

User avatar
bruceholt
Veteran Member
Posts: 100
Joined: 2016-07-30 20:16
Location: Australia

Re: Advanced Charts / FREE amazing resource

Post by bruceholt » 2020-07-11 19:35

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.

SkayyHH
Veteran Member
Posts: 425
Joined: 2015-04-27 21:18

Re: Advanced Charts / FREE amazing resource

Post by SkayyHH » 2022-03-06 01:47

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!

Post Reply