I have got a problem. I am trying to display chart with PHP and my chart code is like this.
Database code
$rowval=$sqcat1->qcategory;
$per=($sqcat1->point_value*100)/($sqcat1->r_count*5);
and chart code
$data3['$rowval'] = $per;
$mc3 = new maxChart($data3);
$mc3->displayChart('Chart',1,500,600,true);
I actually want to pass the value like this
$data3['Windows']=80;
$data3['linux']=10;
$data3['Mac']=10;
etc extracting the data through the database.
I already try it doing like this
$data[$sqcat1->qcategory]= $per;
$mc3 = new maxChart($data);
$mc3->displayChart('Chart',1,500,600,true);
Its displays chart with percentage only not with the category and percent.
I want to display the category as well as percentage.
somebody please help me.
Can you try this
$rowval=$sqcat1->qcategory;
$data["$rowval"]= $per;
$mc3 = new maxChart($data);
$mc3->displayChart('Chart',1,500,600,true);
Please note the double quotes $data["$rowval"]
Related
I am working with Google Sheets. I want to build a custom function that adds 5 cells together. This code worked just fine:
function addData(a,b,c,d,e){
return a+b+c+d+e
}
When I put the values: 80,80,80,80,80...I appropriately get 400.
The problem happens when one of the cells in empty. When I have the values:
___,80,80,80,80 I get 80808080
80,___,80,80,80 I get 808080
80,80,___,80,80 I get 16080
80,80,80,___,80 I get 24080
80,80,80,80,___ I get 320 <--- correct answer
The function appears to add correctly until it hits an empty cell and then just tacks on the remaining values instead of continuing to add them.
I am very new to JavaScripting so I really do not know where to begin my research. Any help would be greatly appreciated. I asked this question before but I feel like this is more concise as to what I am trying to accomplish.
you get different results because each column has different format
try to convert string type to integer
or let script like that and change the column format to number
function addData(a,b,c,d,e){
return parseInt(a)+parseInt(b) +parseInt(c) +parseInt(d) +parseInt(e)
}
I am new to working on flex. I looked at several stackoverflow questions but they didnt seem to answer my question.
I am using Advanced data grid column to display my data in a table. I know that columns can be sorted using the controls on the table being displayed.
But is there a way to sort data based on a single column when the data gets displayed.
I used sortDescending ="true" attribute but no change in the data.
Any help is much appreciated
Try to dispatch event
var adgEvent:AdvancedDataGridEvent =
new AdvancedDataGridEvent(AdvancedDataGridEvent.SORT, false, true);
adgEvent.columnIndex = columnIndex;
adgEvent.dataField = dataField;
adgEvent.triggerEvent = triggerEvent;
adgEvent.multiColumnSort = false;
on your AdvancedDataGrid to sort some column
What is the best way to extract data from a table from an url?
In short I need to get the actual data from the these 2 tables at: http://www.oddsportal.com/sure-bets/
In this example the data would be "Paddy power" and "3.50"
See this image:
(Sorry for posting image like this, but I still need reputation, i will edit later)
http://img837.imageshack.us/img837/3219/odds2.png
I have tried with Jsoup, but i dont know if this is the best way?
And I can't seem to navigate correctly down the tables, I have tried things like this:
tables = doc.getElementsByAttributeValueStarting("class", "center");
link = doc.select("div#col-content > title").first();
String text1 = doc.select("div.odd").text();
The tables thing seem to get some data, but doesn't include the text in the table
Sorry, man. The second field you want to retrieve is filled by JavaScript. Jsoup does not execute JavaScript.
To select title of first row you can use:
Document doc = Jsoup.connect("http://www.oddsportal.com/sure-bets/").get();
Elements tables = doc.select("table.table-main").select("tr:eq(2)").select("td:eq(2)");
System.out.println(tables.select("a").attr("title"));
Chain selects used for visualization.
as you can see the code below it can translate the image data from lotus database to a base64 string. The problem is I manually put the file name of the image (line 4). I have a lots of images on my database and only my "btnbg.jpg" can read it, the others are not. How can my code can read all the image file names inside the database column. Also how can I include the result base64 string to my html image tag. Thank you so much and God bless
var testView:NotesView = database.getView("uploadforms");
var col:NotesDocumentCollection = testView.getAllDocumentsByKey("1");
var testDoc:NotesDocument = col.getFirstDocument();
var attachment:NotesEmbeddedObject = testDoc.getAttachment("btnbg.jpg");
var input:java.io.InputStream = attachment.getInputStream();
var base64Enc = new sun.misc.BASE64Encoder();
var output = new java.io.ByteArrayOutputStream();
base64Enc.encode( input, output );
return output.toString();
"How can my code can read all the image file names inside the database column"
You need to print attachment names in to the column. For example with the help of "#AttachmentNames" function.
You need o use "ViewNavigator" class to traverse column exactly
If you are prefer to work with document, then use some of the methods go get all attachment from document, like "EmbeddedObjects" method on the document and RT items.
"how can I include the result base64 string to my html image tag"
You could do it with the help of css: background:url(data:image/jpeg;base64,...
It's a bad idea to use a lot of pictures in the css base64.
Basically instead of var thing_mc:test_mc=new test_mc I want to somehow do thing_mc:String=new String, where String is defined by an array. I've tried several methods and searched all over, but I can't find out how to do this. I don't know if I'm not searching for the right thing or what, but I just can't find an answer.
Example of what I want:
var anarray:Array=new Array
anarray[0]="thismc"
anarray[1]="thatmc"
var thing_mc:anarray[0]=new anarray[0]
addChild(thing_mc)
I know what's obviously wrong, but I don't know what's right and that's the easiest to understand example of what I'm trying to achieve.
You could use
var anArray:Array = ["AClassName", "AnotherClassName"];
var class:Class = flash.utils.getDefinitionByName(anArray[0]);
var instance:* = new class();
But worth noting is that the classnames you're referencing in your array DO need to be imported somewhere in your project else the application won't be able to find those classes at runtime.