MORRIS LINE GRAPH IN PHP LARAVEL - php

putting multiple lines in graph.
in my project- xaxis- SP values- S
yaxis -CMH values
Each record in tables
for each angle i have SP1 to SP10 and CMH1 to CMH10
For example:
angle 25 degree plot 10 point and form line- 10 point is(sp1,CMH1)(SP2,CMH2).... (SP10,CMH10)
26 degree again another 10 points as above line..
my dataset passing to line graph
"result":[
{"BLADE_ANGLE_ID":1,"SP1":10,"SP2":5,"SP3":6,"SP4":6,"SP5":2,"SP6":2,"SP7":1,"SP8":2,"SP9":3,"SP10":2,"CMH1":12,"CMH2":null,"CMH3":null,"CMH4":null,"CMH5":null,"CMH6":null,"CMH7":null,"CMH8":null,"CMH9":null,"CMH10":null,"CHECKED":1},
{"BLADE_ANGLE_ID":2,"SP1":6,"SP2":7,"SP3":7,"SP4":23,"SP5":32,"SP6":4,"SP7":7,"SP8":9,"SP9":55,"SP10":45,"CMH1":10,"CMH2":null,"CMH3":null,"CMH4":null,"CMH5":null,"CMH6":null,"CMH7":null,"CMH8":null,"CMH9":null,"CMH10":null,"CHECKED":1
}]
Here you can see 2 blade angles and here u have to draw 2 lines with each 10 points(sp,CMH) for 2 different angles

Related

Cutting 2D shapes from 2D shapes and storing the remainder

I have a 10 by 10 sheet of paper. If I remove a 8 by 6, I want to be able to store the remainder as two shapes (that is 2 by 10 and 10 by 4) into a database. Now, if I need to use a 10 by 4, I should be able to cut it from the 10 by 4 but then this should also update the dimensions of the 2 by 10.
Yellow is the initially removed 86, blue and red is the 210, green and red is the 4*10
I tried storing them separately but I do not know when/how to ascertain when the dimension of the new required piece are now interfering with both the shapes

Display data in html extracted from pdf document in php

I am trying to display data extracted from PDF document. Here is sample data which I've got in raw format from pdf 55.0 450.0 320.0 GA350C CARDS 4 21 90.0 4 1 DIGCLR This is one row where every space represent one column. I can extract each column with substr() function in PHP but I am not sure how to display data when there are three or five rows data in there, cos doesn't matter its one row or five row data will display in single line.
I can only count rows with no of space in it, here only one thing is fixed which is no of columns so so need to iterate loop efficiently.
If anyone has better idea plz let me know.
Here is string which I extracted from pdf doc with help of PdfParser.
5284 25/10/16 DATE JOB REC'D: DATE DUE: 26/10/16 JOB NUMBER: The Print Group CUSTOMER NAME: 30 days CONTACT: Tanya Bulley PHONE: (07) 3395 7248 FAX: (07) 3395 9462 ORDER NUMBER: 234456/277458 ADDRESS: The Print Group 88 Webster Road Geebung Qld 4034 Australia 5,289 QUOTE NO: PREVIOUS JOB NO: 0 2,000 Business Cards - Shed Company 2 KINDS JOB: DESCRIPTION: PRE-PRESS: Supplied Print Ready Files/ No Proof Required SIZE: BC 90 x 55mm PRINTED: CMYK 2/sides STOCK: 350gsm Gloss Art FINISH:Trim to size QTY: 2000 (1,000 each name) PACK: Carton Pack DELIVERY: 1 Point ACT [1]SPECIAL INSTRUCTIONS: Artwork Received SPECIAL INSTRUCTIONS: Out on Proof Approved Stock TYPE/ART CUTTING Proofing Pre Press Proofing 0.50 TRIMMING CARDS TRIM MAKE READY CARDS TRIM 90 x 55 STOCK 96.00 CARDS Sovereign Gloss 450x320/350 FINISHING PACK/DELIVERY PACK A4 Cartons 305x215/280 Standard Local Delivery (by we INK/CHEMICALS OUTSIDE WORK Delivery: The Print Group 88 Webster Road Geebung Qld 4034 Press Sheet Press Code Stock Code No. of Work & Turn No Up No. of Colours Front Back Description Ink Code Front Back Trim Size Depth Width Ink Notes 55.0 450.0 320.0 GA350C CARDS 4 21 90.0 4 1 DIGCLR
This is basically job order for printers and last line is job details. Right now its only one row for actual job details but in some order it can go upto 10 rows and so its hard to save it in database with proper column name. To grab words or details I used:
function GetBetween($content,$start,$end)
{
$r = explode($start, $content);
if (isset($r[1])){
$r = explode($end, $r[1]);
return $r[0];
}
return '';
}
this function. I used this function like $cust_name = GetBetween($a,'JOB NUMBER:','CUSTOMER NAME:'); I also used substr() php function to get some details and with these I've got everything apart from main data which is at last in string (I mentioned it above). I hope this explanation help you to figure out whole situation.
Sorry, i try to explain with bulk of code and long description, but stackoverflow not allow me to writing that. i'm so frustated because i spend 2 hours to doing it with my notepad
now i will give you simple clue for doing this
Avoid to using <*table> tag, try to using <*div> (only abbyy can convert <*table> near perfectly). This optional requirement
Convert PDF to DOM TREE, i recommended convert to HTML, AND this must be automation via PHP.
for Paid software: Abbyy Fine reader or Abbyy transformer (lite version)
for Free software: pdftohtml from poppler
from my experience around 5years doing this, i recommended you to use
Abbyy. And ALL of Indonesian corporation which provide digital
newspaper clipping use this software (im pretty sure about this). If
you dont have money , you must know how to get that.(i cant say it
here)
Grab HTML DOM with regular expression (regex) or http://simplehtmldom.sourceforge.net/
Another clue :
if you have problem to grab content using regex/htmldom,
1. try to get rid DOM that you dont need it. You can use preg_replace
[trash]
[YOUR_TABLE]
[trash]
then start to grab your content from this snippet
If you can edit PDF creation process, try to add unique word/string around your content
[trash]
<div>this is title</div>
[YOUR TABLE]
<div>this is footer</div>
[trash]
so you can search your content around word THis is title and this is footer.

PChart Right axis to show labels for specific values

I currently have the wind chart shown below working with the mean, low and high values.
What i would like to add but i can figure out is:
I need a plot a right hand scale that would show the wind force. I would guess this would be set as a label for a specific value.
So in this case
label for force 1 should be in line with wind speed 1
label for force 2 should be in line with wind speed 4
label for force 3 should be in line with wind speed 7
label for force 4 should be in line with wind speed 11
label for force 5 should be in line with wind speed 17
is there anyway i can create a y axis that shows a specic label at specific value?
thus creating something like this: but where the numbers line up to the right values
Here is what worked for my application. I was making a particle count graph:
$MyData->addPoints(array(7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24),"ISO");
$MyData->setSerieOnAxis("ISO",1);
$MyData->setAxisName(1,"ISO Code");
$MyData->setAxisPosition(1,AXIS_POSITION_RIGHT);
$MyData->setSerieDrawable("ISO", FALSE); //dont plot results just show axis
then further down where you do your scale:
$AxisBoundaries = array(0=>array("Min"=>0,"Max"=>5),1=>array("Min"=>7,"Max"=>24));
$ScaleSettings = array("Mode"=>SCALE_MODE_MANUAL,"ManualScale"=>$AxisBoundaries);
$myPicture->drawScale($ScaleSettings);
So you set the scale for the left and right axis there. In my application my right side needed to go from 7 to 24 and my left side from 0 to 5. I didnt plot my right side graph, as I just wanted to show the scale.
You pretty much have to fiddle with your min and max to get them to line up where you want and you have to make sure the left axis is fixed. If its dynamic then it will be different each time depending on your data.

Draw textual PHP graph

I need to draw a line chart using PHP which fullfills the following requirements:
Textual X-Axis descriptors
Not every serie has values for all X-Axis values
Markers on the given points
I have already detailed watched pChart, JpGraph and LibChart, but I didn't manage to get the expected result. It should look like this (poorly drawn with MsPaint):
EDIT: The exact problems:
With Libchart, I didn't manage to get different series with not all x axis values filled
With pChart, there was the same problem (e.g. at the above example, pChart would not make a line at the blue series from desc 3 to desc 6, when values 4 and 5 have the value VOID). I could also calculate the values between, but then they would also have markers (e.g. at desc 4 and desc 5)
With JpGraph, I didn't manage to create textual x axis values
Thank you for your help, Community!
Found a solution using pChart:
I can use VOID for points which do not have an own value, and set a config setting like the following one:
$myPicture->drawLineChart(array('BreakVoid'=>false,'VoidTicks'=>0));
Using this settings, VOID will draw correct lines to the next known value.

Pear Excel Writer: how to assign leading zeros to column?

There's a section in my website that allows to export an Excel file by clicking a button. The data displayed in the Excel file is taken from my database using SQL.
The following are examples of what is found in the column in my database:
12
34
456
2
7654
43
1234
7
Currently it displays identically as above in the Excel sheet, but what I would like would be for all the rows to have 4 digits. Therefore, data with less than 4 digits would have leading zeros added to it.
Using the same example, here is how I would like it to show in the exported Excel sheet:
0012
0034
0456
0002
7654
0043
1234
0007
This seems like a relatively simple task, but I cant seem to find how to make this happen through my research. I hope someone here will be able to help.
Thank you.
$number = str_pad($value, 4, '0', STR_PAD_LEFT);

Categories