<?phperror_reporting(E_ALL);ini_set('display_errors',TRUE);ini_set('display_startup_errors',TRUE);require_once'phplot.php';$image_map="";$title=$_POST['Shoe_name'];$heal_fit=$_POST['Heal_Fit'];$forefoot_fit=$_POST['Forefoot_Fit'];$midfoot=$_POST['Midfoot'];$toe_Box_depth=$_POST['Toe_Box_Depth'];$arch_height=$_POST['Arch_Height'];$forefoot_flex=$_POST['Forefoot_Flex'];$forefoot_feel=$_POST['Forefoot_Feel'];if(isset($_POST["submit"])){if(empty($heal_fit)||empty($forefoot_fit)||empty($midfoot)||empty($toe_Box_depth)||empty($arch_height)||empty($forefoot_flex)||empty($forefoot_feel)){echo"You did not fill out the required fields.";}else{$data=array(array('Forefoot Feel',$forefoot_feel),array('Forefoot Flex',$forefoot_flex),array('Arch Height',$arch_height),array('Toe Box Depth',$toe_Box_depth),array('Midfoot',$midfoot),array('Forefoot Fit',$forefoot_fit),array('Heal Fit',$heal_fit),);#Callbackfor'data_points':Generate1<area>lineintheimagemap:
functionstore_map($im,$passthru,$shape,$row,$col,$x1,$y1,$x2,$y2){global$image_map;#Title,alsotool-tiptext:
$title="Group $row, Bar $col";#Requiredalt-text:
$alt="Region for group $row, bar $col";#LinkURL,fordemonstrationonly:
$href="javascript:alert('($row, $col)')";#Convertcoordinatestointegers:
$coords=sprintf("%d,%d,%d,%d",$x1,$y1,$x2,$y2);#Appendtherecordforthisdatapointshapetotheimagemapstring:$image_map.=" <area shape=\"rect\" coords=\"$coords\""." title=\"$title\" alt=\"$alt\" href=\"$href\">\n";}#CreateandconfigurethePHPlotobject.$plot=newPHPlot(640,480);#Disableerrorimages,sincethisscriptproducesHTML:
$plot->SetFailureImage(False);#DisableautomaticoutputoftheimagebyDrawGraph():$plot->SetPrintImage(False);#Setuptherestoftheplot:
$plot->SetTitle($title);$plot->SetImageBorderType('plain');$plot->SetDataValues($data);// $plot->SetDataType('text-data');$plot->SetYTickPos('plotleft');$plot->SetAxisFontSize('5');$plot->SetXTickPos('plotup');// No X axis labels. The data values labels are sufficient.$plot->SetXTickLabelPos('plotup');$plot->SetDataType('text-data-yx');// $plot->SetLegendPosition(0, 0, 'image', 0, 0, 5, 5);$plot->TuneYAutoRange(0,'R',0);$plot->TuneYAutoTicks(NULL,'binary');$plot->SetPlotType('bars');$plot->SetXTickPos('none');$plot->SetAxisFontSize('5');// Set the bar fill color:$plot->SetDataColors('green');// Use less 3D shading on the bars:$plot->SetShading(10);#Setthedata_pointscallbackwhichwillgeneratetheimagemap.$plot->SetCallback('data_points','store_map');// $plot->SetPlotAreaWorld(NULL, 0, NULL, 100);$plot->SetPlotAreaWorld(0);//$plot->SetPlotAreaWorld(NULL, -10, NULL, 10);#Producethegraph;thisalsocreatestheimagemapviacallback:
$plot->TuneYAutoRange(0);$plot->TuneXAutoRange(0);$plot->DrawGraph();$newimg=$plot->EncodeImage();#NowoutputtheHTMLpage,withimagemapandembeddedimage:
?><!DOCTYPEHTMLPUBLIC"-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><html><head><title>PHPlotExample: BarChartwithImageMap</title></head><body><h1>PHPlotExample: BarChartwithImageMap</h1><mapname="map1"><?phpecho$image_map;?></map><p>imagemapof<?phpecho$title;?></p><imgsrc="<?php echo $newimg;?>"alt="Plot Image"usemap="#map1"></body></html><?php}}else{echo"please submit the form";}
Last edit: lbayuk 2016-02-10
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Admin note: I changed your second post to put markers around the code so it would display better. I also edited your first post to change the images into just URLs. For some reason, Sourceforge put these posts into a Moderation queue even though the forum is set to not be moderated. I thought it might be because of the images loaded from numeric IP addresses, so I removed the image markup and left just the URLs. This way people can choose whether to load them or not.
As for your actual code and question, I will take a look shortly.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am not sure what you mean by "remove the decimal value on the axis". Do you mean in the tick label values along the X axis at the top? (Remember that even with a horizontal bar chart, the horizontal axis is X, and the vertical axis is Y.) I see 0 0.5 1 1.5 etc. If you want them to be whole numbers, then you can use either this, which forces the tick step to 1:
$plot->SetXTickIncrement(1)
or this, which forces the ticks to be whole integers:
$plot->TuneXAutoTicks(NULL, NULL, True);
(Which of these is better would depend on the range of data you expect to see.)
If I am not understanding what you are asking, please clarify.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you for the Reply
I want to download the image created , please tell me how I can doe that by code.
As the image is encoded , its name in the img src is very big
Also how can I customizwe the look like
Till now I have recahed to
Please suggest
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
http://208.109.186.112/pradeepma/dyanamic_graph/d2/rating.png
this is the Image I genearted from the taking value from the html form.
I am stuck, I dont now hoe to remove the decimal value on the axis.
Also I want to add amake the image more attactive like Rating for a product for example like
http://208.109.186.112/pradeepma/dyanamic_graph/d2/example.jpg
Here is the link of the HTML page http://208.109.186.112/pradeepma/dyanamic_graph/d2/a1.php
Please help as I am stuck.
[Edits by admin: see 3rd thread in post]
Last edit: lbayuk 2016-02-10
Code at the php file
Last edit: lbayuk 2016-02-10
Admin note: I changed your second post to put markers around the code so it would display better. I also edited your first post to change the images into just URLs. For some reason, Sourceforge put these posts into a Moderation queue even though the forum is set to not be moderated. I thought it might be because of the images loaded from numeric IP addresses, so I removed the image markup and left just the URLs. This way people can choose whether to load them or not.
As for your actual code and question, I will take a look shortly.
I am not sure what you mean by "remove the decimal value on the axis". Do you mean in the tick label values along the X axis at the top? (Remember that even with a horizontal bar chart, the horizontal axis is X, and the vertical axis is Y.) I see 0 0.5 1 1.5 etc. If you want them to be whole numbers, then you can use either this, which forces the tick step to 1:
or this, which forces the ticks to be whole integers:
(Which of these is better would depend on the range of data you expect to see.)
If I am not understanding what you are asking, please clarify.
Thank you for the Reply
I want to download the image created , please tell me how I can doe that by code.
As the image is encoded , its name in the img src is very big
Also how can I customizwe the look like
Till now I have recahed to
Please suggest