473,320 Members | 2,027 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Is this in Java Languages???

Hi... I would like to know if the bold part is using java languages or is it some other languages???

[PHP]<?php
session_start();
require('db.php');

mysql_connect(MACHINE, USER, '');
mysql_select_db(DBNAME);

//Obtaining session variables (From do_login.php)
$uname = $_SESSION['username'];
$pwd =$_SESSION['pwd'];
$outletid = $_SESSION['outletid'];
$role = $_SESSION['role'];
$userid = $_SESSION['userid'];

$month = $_POST['month'];
$year = $_POST['year'];

class easyChart {
var $title;
var $width;
var $height;
var $bartitle;
var $barheight;
var $barwidth;
var $background;
var $multiply;
var $spacebar;
var $leftspace;
var $rightspace;
var $upspace;
var $bottomspace;
var $leftlegend;
var $linecolor;
var $barcolor;
var $titlecolor;
var $legendcolor;
var $barinfocolor;

function easyChart () {
$this->title = "Chart Title";
$this->background = Array(153,204,102);
$this->linecolor = Array(240,240,240);
$this->barcolor = Array(255,255,153);
$this->titlecolor = Array(111,166,55);
$this->legendcolor = Array(0,0,0);
$this->barinfocolor = Array(0,0,0);
$this->width = 600;
$this->height = 500;
$this->barwidth = 20;
$this->leftspace = 75;
$this->rightspace = 25;
$this->upspace = 50;
$this->bottomspace = 50;
$this->leftlegend = 10;
$this->chartlegend = "";
}

function setTitleColor ($color) {
$this->titlecolor = explode(",",$color);
}
function setLegendColor ($color) {
$this->legendcolor = explode(",",$color);
}
function setBarInfoColor ($color) {
$this->barinfocolor = explode(",",$color);
}
function setBarColor ($color) {
$this->barcolor = explode(",",$color);
}
function setLineColor ($color) {
$this->linecolor = explode(",",$color);
}
function setLeftLegend ($leftlegend) {
$this->leftlegend = $leftlegend;
}
function setLeftSpace ($leftspace) {
$this->leftspace = $leftspace;
}
function setRightSpace ($rightspace) {
$this->rightspace = $rightspace;
}
function setTitle ($title) {
$this->title = $title;
}
function setBackground ($color) {
$this->background = explode (",", $color);
}
function setWidth ($width) {
$this->width = $width;
}
function setHeight ($height) {
$this->height = $height;
}
function setBarWidth ($barwidth) {
$this->barwidth = $barwidth;
}
function addBar ($bartitle, $barheight) {
$this->bartitle[] = $bartitle;
$this->barheight[] = $barheight;
}
function prepare() {
$this->chartlegend .= "";
$arr = $this->barheight;
sort ($arr);
reset ($arr);
$this->highestvalue = end($arr);
$this->valueincriement = $this->highestvalue / $this->leftlegend;
$this->multiply = ( ($this->height-($this->upspace + $this->bottomspace)) / $this->highestvalue);
$this->spacebar = ( ($this->width - ($this->leftspace + $this->rightspace)) - ($this->barwidth * count($arr) ) ) / (count($arr)+1);
$this->legendspace = ($this->height - ($this->upspace+$this->bottomspace)) / $this->leftlegend;
if ($this->barwidth * count($this->barheight) > ($this->width-($this->upspace+$this->bottomspace))) $err = "Bar width is to large";
if ($err!="") {
print $err;
exit;
}
}
function generateChart() {
$im = ImageCreate($this->width,$this->height);
$white = ImageColorAllocate($im,255,255,255);
$background = ImageColorAllocate($im,$this->background[0], $this->background[1],$this->background[2]);
$black = ImageColorAllocate($im,0,0,0);
$gray = ImageColorAllocate($im,100,100,100);
$linecolor = ImageColorAllocate($im,$this->linecolor[0], $this->linecolor[1],$this->linecolor[2]);
$barcolor = ImageColorAllocate($im,$this->barcolor[0], $this->barcolor[1],$this->barcolor[2]);
$titlecolor = ImageColorAllocate($im,$this->titlecolor[0], $this->titlecolor[1],$this->titlecolor[2]);
$legendcolor = ImageColorAllocate($im,$this->legendcolor[0], $this->legendcolor[1],$this->legendcolor[2]);
$barinfocolor = ImageColorAllocate($im,$this->barinfocolor[0], $this->barinfocolor[1],$this->barinfocolor[2]);
@ImageFilledRectangle($im,0,25,$this->width,$this->height-15,$background);
@ImageFilledRectangle($im,1,26,$this->width-2,$this->height-16,$white);
@ImageFilledRectangle($im,2,27,$this->width-3,$this->height-17,$background);
@ImageFilledRectangle($im,$this->leftspace,$this->upspace-10, $this->width-$this->rightspace,$this->height-($this->bottomspace-20),$white);
$titlewidth = strlen($this->title) * ImageFontWidth(5);
$titlexpos = ($this->width - $titlewidth)/2;
@ImageString ($im, 5, $titlexpos, 5, $this->title, $titlecolor);
@ImageString ($im, 1, 0, $this->height - 10, base64_decode($this->chartlegend.""), $black);
for($i=0;$i<=$this->leftlegend;$i++){
$legendx = 5;
$legendy = $this->upspace + ($this->legendspace * $i) - 6;
@ImageString($im, 2, $legendx, $legendy, $this->highestvalue-($this->valueincriement*$i), $legendcolor);
@ImageLine ($im, $this->leftspace, $legendy+6, $this->width - $this->rightspace, $legendy+6, $linecolor);
}
for($i=0;$i<count($this->barheight);$i++){
$j=$i+1;
$x1 = ($j * $this->spacebar) + ($i * $this->barwidth) + $this->leftspace;
$y1 = $this->height - ($this->barheight[$i]*$this->multiply) - $this->upspace;
$x2 = $x1 + $this->barwidth;
$y2 = $this->height - $this->bottomspace;
$bartitlewidth = strlen($this->bartitle[$i]) * ImageFontWidth(2);
$centerofbar = $x1 + ($this->barwidth / 2);
$bartitlex = $centerofbar - ($bartitlewidth/2);
$bartitley = $y2 + 5;
@ImageFilledRectangle($im, $x1, $y1, $x2, $y2, $barcolor);
@ImageString($im, 2, $bartitlex, $bartitley, $this->bartitle[$i], $barinfocolor);
}
@ImageJPEG($im);
@ImageDestroy($im);
}
};

// HERE IS THE EXAMPLE TO USE THE CHART CLASS
$chart = new easyChart(); // Object initialized
$chart->setTitle("Stock Item Graph"); // Title of Chart
$chart->setBackground("153,204,102"); // Background of chart [opt]
$chart->setLineColor("225,225,225"); // Line color separator [opt]
$chart->setBarColor("255,255,153"); // Bar color [opt]
$chart->setTitleColor("111,166,55"); // Color Title [opt]
$chart->setLegendColor("0,0,0"); // Legend Color [opt]
$chart->setBarInfoColor("0,0,0"); // Bar Info Color [opt]
$chart->setWidth(800); // Width of Chart
$chart->setHeight(500); // Height of Chart
$chart->setBarWidth(20); // Bar Width
$chart->setLeftSpace(55); // Left Space
$chart->setRightSpace(25); // Right Space
$chart->setLeftLegend(10); // Left Legend

$sql="SELECT SUM(quantity), SUM(amount), category FROM invoice WHERE category='Bottoms - Shorts' AND month = '$month' AND year = '$year' GROUP BY category";
$results=mysql_query($sql) or die(mysql_error());
$rows = mysql_fetch_array($results);
$shorts = $rows['SUM(quantity)'];

$sql="SELECT SUM(quantity), SUM(amount), category FROM invoice WHERE category='Bottoms - Skirts' AND month = '$month' AND year = '$year' GROUP BY category";
$results=mysql_query($sql) or die(mysql_error());
$rows = mysql_fetch_array($results);
$skirts = $rows['SUM(quantity)'];

$sql="SELECT SUM(quantity), SUM(amount), category FROM invoice WHERE category='Outerwear - Coats' AND month = '$month' AND year = '$year' GROUP BY category";
$results=mysql_query($sql) or die(mysql_error());
$rows = mysql_fetch_array($results);
$coats = $rows['SUM(quantity)'];

$sql="SELECT SUM(quantity), SUM(amount), category FROM invoice WHERE category='Tops - Blouse' AND month = '$month' AND year = '$year' GROUP BY category";
$results=mysql_query($sql) or die(mysql_error());
$rows = mysql_fetch_array($results);
$blouse = $rows['SUM(quantity)'];

$sql="SELECT SUM(quantity), SUM(amount), category FROM invoice WHERE category='Others' AND month = '$month' AND year = '$year' GROUP BY category";
$results=mysql_query($sql) or die(mysql_error());
$rows = mysql_fetch_array($results);
$others = $rows['SUM(quantity)'];

$chart->addBar("Bottoms - Shorts",$shorts); // Sample content of chart
$chart->addBar("Bottoms - Skirts",$skirts);
$chart->addBar("Outerwear - Coats",$coats);
$chart->addBar("Tops - Blouse",$blouse);
$chart->addBar("Others",$others);


$chart->prepare(); // Chart Preparation
$chart->generateChart(); // Chart Generation
?>[/PHP]
Jan 10 '08 #1
3 1152
acoder
16,027 Expert Mod 8TB
I think you mean JavaScript (since you've posted this in the JavaScript forum).

The answer is no - it's PHP. Is there a problem with the code?
Jan 10 '08 #2
mmm.... i can't name both the x-axis and y-axis... i can only get the labels for the axis... so it's PHP codes... ok... sorry for posting it here...
Jan 10 '08 #3
acoder
16,027 Expert Mod 8TB
I see you've already started a thread in the PHP forum, so there's no point moving this thread. Good luck!
Jan 10 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

54
by: Jerry | last post by:
What are the advantages and disadvantages of using Object Oriented PHP vs Java?
73
by: RobertMaas | last post by:
After many years of using LISP, I'm taking a class in Java and finding the two roughly comparable in some ways and very different in other ways. Each has a decent size library of useful utilities...
133
by: Gaurav | last post by:
http://www.sys-con.com/story/print.cfm?storyid=45250 Any comments? Thanks Gaurav
31
by: somebody | last post by:
No, I'm not a troll, just angry. I just started learning C++, and find it extremely lacking compared to Java. For example, I had to write my own functions to do something as simple as a case...
18
by: steve.anon | last post by:
Hi I'm a Java developer moving to windows only applications. Of course the first thing I thought was "well at least, without the VM now I can write desktop applications that run real fast". So I...
5
by: TZESENG | last post by:
DECEMBER 13, 2005 . Editions: N. America | Europe | Asia | Edition Preference News Analysis By Steve Hamm Source: http://www.businessweek.com/technology/content/dec2005/tc20051213_042973.htm...
458
by: wellstone9912 | last post by:
Java programmers seem to always be whining about how confusing and overly complex C++ appears to them. I would like to introduce an explanation for this. Is it possible that Java programmers...
15
by: RAM | last post by:
Hello, I graduated computer science faculty and decided to became a programmer. Please help me to make a decision: Java or Microsoft .NET? What is the future of Java? Thanks! /RAM/
29
by: walterbyrd | last post by:
Some think it will. Up untill now, Java has never been standard across different versions of Linux and Unix. Some think that is one reason that some developers have avoided Java in favor of...
27
by: Generic Usenet Account | last post by:
Apologies if someone finds this OT I am looking for an open-source C++ implementation of Java API ---- something that does not require a Java run-time environment. So far the only thing that I...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.