Would it be possible to just label the x axis by the minimum value and the maximum value instead of having values inbetween?
More info on what I'm graphing:
I have a large dataset of dates that I am graphing. Currently I am scaling it to a scale of 0-100 to graph it. I just want to label 0 as the lowest date and 100 as the highest date.
Look at setFixedScale()
$Test->setFixedScale(0,100,1);
That will show 0 as the min and then 100 as the max
Related
I'm trying to get the calculated height of a row in PHPSpreadsheet but whenever I do something like
$spreadsheet->getActiveSheet()->getRowDimension($row)->getRowHeight();
I always get a -1 value which is correct based on their documentation as that is the default value. I need to get the calculated height in pt though as I need to do some calculations. I have a cell that is set to wrap text, and spans multiple lines. Anyone knows how to get the calculated height of a row?
-1 is the value of auto height. Means the value will calculated automatically. If you need a number of height. I would suggest to calc the height over the value of the cell. You must do following: Find newlines in the content and multiply them with 12.75 pts (standard height). Some informations you can find here to.
When I set format of a cell as %, it automatically multiplies the value with 100 & shows the value. So 94 becomes 9400%.
I want to apply % format on a column but want to keep the values same as before. I just want % sign to be shown along with the value. My Value should be 94% . To achieve this, I used following format code
$this->_xls_current_sheet->getStyle($cell_coordinates)->getNumberFormat()->applyFromArray(
array(
'code' => PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE
));
If you store 0.5 in a cell, and format it as a percentage, then it will appear as 50%.... if you store 50 in a cell, and format it as a percentage, then it will appear as 5000% that is how it should be.
If you enter 50 as a number in the MS Excel GUI, and then set the format mask manually to a percentage, you will get a displayed value of 5000%. However, if you enter 50% in the MS Excel GUI, then MS Excel divides the value by 100 to store 0.5 in the cell, and formats it as a percentage (two actions in one step). If you set 50% in this way in MS Excel, and then change the format mask from percentage to number, then you will see that MS Excel has done this division for you.
PHPExcel doesn't do this (by default)... it expects you to set the correct value and the format as two separate steps. So PHPExcel expects you to store the correct value in the cell (0.5) in the first place, when you want to format it as a percentage.... it will not magically change the value in any way, it doesn't multiply it at all.
Note that if you are using the advanced value binder (rather than the default value binder), and set the cell value to 50%, then PHPExcel will divide by 100 and set to a percentage automatically, in the same way as the MS Excel GUI.
I'm making a program and i'm using PHPExcel. Inside the program you can select width and height. (width is the green row, and blue is the height)
All the white numbers are prices.
Lets say i insert 1400 width and 1600 height. the price should be 640. How can i achieve this?
The easiest option is to find which column contains 1400 in Row 1 (D in your example), and which row contains 1600 in column A (5 in your example), and then use that to read the value at that cell (D5)
A somewhat cleverer way is to use an Excel Formula:
=INDIRECT(CONCATENATE(SUBSTITUTE(ADDRESS(1,MATCH(1400,A1:E1,0),4),1,""),MATCH(1600,A1:A17,0)))
substituting the appropriate lookup values for 1400 and 1600, and adjusting the MATCH ranges to the full size for your width and height lookups.... In MS Excel itself, you could use row and column ranges (A:A) and (1:1), but the PHPExcel calculation engine won't handle row and column ranges correctly, but it will work with cell ranges
As an explanation for the above formula:
MATCH(1400,A1:E1,0)
Does a lookup for value 1400 in the cell range A1:E1 (looking for a match for your width). The returned value for MATCH() is a numeric offset in that row for the column where it is found. In this case, it will return 4.
SUBSTITUTE(ADDRESS(1,<4>,4),1,"")
Converts the column number to a column letter... e.g converts 4 to D. if your range didn't start at A, then you'd have to add an offset to get the correct letter
MATCH(1600,A1:A17,0)
Similar to the previous MATCH, but this time searching in your heights column range (A1:A17) for the value 1600. It will return the offset within that range where it finds the value. Again, if your range doesn't start in row 1, then you'd need to add an offset. In your case, it will return 5.
CONCATENATE(<D>,<5>)
Concatenates the calculated column and row values together to give a cell address (D5)
INDIRECT(<D5>)
Reads the value at the cell address that we've calculated (D5) giving the value 640
I have to read out some values from a database and create a line diagram with it.
The values i get from the database are the time in ms(going up to 72000) for the x-axis, and a value between 0 and 10 for the y-axis.
How do I get the values ranging from 0 to 72000 into the picture which has to have a width of 800px and how do use the complete 600px of the y-axis with the 0-10 values?
I'm using jpgraph to create some plots from measured data.
Now I have a scatter-plot with large numbers on the y-axis.
I would like to change the number format to a number and exponent instead of just showing an integer. Unfortunately I did not find any solution on-line.
The y-axis has a range of 0 to 12000000. I want to display 12E6 instead of 12000000.
Is this possible? Maybe with the SetFormat?