Failed 2 Chart Attempt
Created: 2011-09-21 18:13:12
Last updated: 2011-09-21 18:13:09
Tried to show 2 charts simulatneously.
Preview
Run
Run this Workflow in the Taverna Workbench...
Workflow Components
Authors (1)
Titles (1)
Descriptions (1)
Tried to show 2 charts simulatneously. |
Dependencies (0)
Processors (9)
Name |
Type |
Description |
SpreadsheetImport |
spreadsheet |
|
GenerateGraphURL |
beanshell |
ScriptStringBuilder sb = new StringBuilder();
sb.append("http://chart.apis.google.com/chart?");
sb.append("cht=bvg");
sb.append("&chs=500x300");
sb.append("&ch=");
sb.append("&chxt=x,y,y");
sb.append("&chbh=5,1,5");
sb.append("&chxr=0,");
sb.append(Float.parseFloat(years.get(0)).intValue());
sb.append(",");
sb.append(Float.parseFloat(years.get(years.size() - 1)).intValue());
sb.append(",2|1,0,25");
sb.append("&chds=0,3000");
sb.append("&chxl=2:|100%20Acres");
sb.append("&chxp=2,50");
sb.append("&chco=FF0000,00FF00,0000FF");
sb.append("&chdl=|");
for (int i = 0; i < headers.size(); i++) {
sb.append(headers.get(i).replace(" ", "%20"));
if (i+1 < data.size()) {
sb.append("|");
}
}
if (title != void) {
sb.append("&chtt=");
sb.append(type);
}
if (data != void) {
sb.append("&chd=t:");
for (int i = 0; i < data.size(); i++) {
List data1 = (List) data.get(i);
for (int j = 0; j < data1.size(); j++) {
Float value = Float.parseFloat(data1.get(j));
sb.append(value.intValue());
if (j+1 < data1.size()) {
sb.append(",");
}
}
if (i+1 < data.size()) {
sb.append("|");
}
}
}
graphURL = sb.toString(); |
Beanshell |
beanshell |
Scriptdata = new ArrayList();
headers = new ArrayList();
headers.add(Year.remove(0));
headers.add(Yield.remove(0));
headers.add(Total.remove(0));
headers.add(Production.remove(0));
headers.add(PerCwt.remove(0));
headers.add(AreaPlanted.remove(0));
headers.add(AreaHarvested.remove(0));
data.add(Year);
data.add(Yield);
data.add(Total);
data.add(Production);
data.add(PerCwt);
data.add(AreaPlanted);
data.add(AreaHarvested);
Year.remove(0);
years = Year; |
SpreadsheetImport_2 |
spreadsheet |
|
GenerateGraphURL_2 |
beanshell |
ScriptStringBuilder sb = new StringBuilder();
sb.append("http://chart.apis.google.com/chart?");
sb.append("cht=bvg");
sb.append("&chs=500x300");
sb.append("&ch=");
sb.append("&chxt=x,y,y");
sb.append("&chbh=5,1,5");
sb.append("&chxr=0,");
sb.append(Float.parseFloat(years.get(0)).intValue());
sb.append(",");
sb.append(Float.parseFloat(years.get(years.size() - 1)).intValue());
sb.append(",2|1,0,25");
sb.append("&chds=0,3000");
sb.append("&chxl=2:|100%20Acres");
sb.append("&chxp=2,50");
sb.append("&chco=FF0000,00FF00,0000FF");
sb.append("&chdl=");
for (int i = 0; i < headers.size(); i++) {
sb.append(headers.get(i).replace(" ", "%20"));
if (i+1 < data.size()) {
sb.append("|");
}
}
if (title != void) {
sb.append("&chtt=");
sb.append(type);
}
if (data != void) {
sb.append("&chd=t:");
for (int i = 0; i < data.size(); i++) {
List data1 = (List) data.get(i);
for (int j = 0; j < data1.size(); j++) {
Float value = Float.parseFloat(data1.get(j));
sb.append(value.intValue());
if (j+1 < data1.size()) {
sb.append(",");
}
}
if (i+1 < data.size()) {
sb.append("|");
}
}
}
graphURL = sb.toString(); |
Get_Image_From_URL_2 |
localworker |
ScriptURL inputURL = null;
if (base != void) {
inputURL = new URL(new URL(base), url);
} else {
inputURL = new URL(url);
}
byte[] contents;
if (inputURL.openConnection().getContentLength() == -1) {
// Content size unknown, must read first...
byte[] buffer = new byte[1024];
int bytesRead = 0;
int totalBytesRead = 0;
InputStream is = inputURL.openStream();
while (bytesRead != -1) {
totalBytesRead += bytesRead;
bytesRead = is.read(buffer, 0, 1024);
}
contents = new byte[totalBytesRead];
} else {
contents = new byte[inputURL.openConnection().getContentLength()];
}
int bytesRead = 0;
int totalBytesRead = 0;
InputStream is = inputURL.openStream();
while (bytesRead != -1) {
bytesRead = is.read(contents, totalBytesRead, contents.length - totalBytesRead);
totalBytesRead += bytesRead;
if (contents.length==totalBytesRead) break;
}
image = contents;
|
Beanshell_2 |
beanshell |
Scriptdata = new ArrayList();
headers = new ArrayList();
headers.add(Year.remove(0));
headers.add(Yield.remove(0));
headers.add(Total.remove(0));
headers.add(Production.remove(0));
headers.add(PerCwt.remove(0));
headers.add(AreaPlanted.remove(0));
headers.add(AreaHarvested.remove(0));
data.add(Year);
data.add(Yield);
data.add(Total);
data.add(Production);
data.add(PerCwt);
data.add(AreaPlanted);
data.add(AreaHarvested);
Year.remove(0);
years = Year; |
NY_url_value |
stringconstant |
Valuehttp://www.myexperiment.org/files/570/download/PS3-NY-Broccoli.xls |
NJ_url_value |
stringconstant |
Valuehttp://www.myexperiment.org/files/569/download/PS3-NJ-Broccoli.xls |
Beanshells (4)
Name |
Description |
Inputs |
Outputs |
GenerateGraphURL |
|
title
data
headers
years
|
graphURL
|
Beanshell |
|
AreaHarvested
AreaPlanted
PerCwt
Production
Total
Year
Yield
|
data
headers
years
|
GenerateGraphURL_2 |
|
title
data
headers
years
|
graphURL
|
Beanshell_2 |
|
AreaHarvested
AreaPlanted
PerCwt
Production
Total
Year
Yield
|
data
headers
years
|
Datalinks (25)
Source |
Sink |
NY_url_value:value |
SpreadsheetImport:fileurl |
Beanshell:data |
GenerateGraphURL:data |
Beanshell:headers |
GenerateGraphURL:headers |
Beanshell:years |
GenerateGraphURL:years |
SpreadsheetImport:AreaHarvested |
Beanshell:AreaHarvested |
SpreadsheetImport:AreaPlanted |
Beanshell:AreaPlanted |
SpreadsheetImport:PerCwt |
Beanshell:PerCwt |
SpreadsheetImport:Production |
Beanshell:Production |
SpreadsheetImport:Total |
Beanshell:Total |
SpreadsheetImport:Year |
Beanshell:Year |
SpreadsheetImport:Yield |
Beanshell:Yield |
NJ_url_value:value |
SpreadsheetImport_2:fileurl |
Beanshell_2:data |
GenerateGraphURL_2:data |
Beanshell_2:headers |
GenerateGraphURL_2:headers |
Beanshell_2:years |
GenerateGraphURL_2:years |
SpreadsheetImport_2:AreaHarvested |
Beanshell_2:AreaHarvested |
SpreadsheetImport_2:AreaPlanted |
Beanshell_2:AreaPlanted |
SpreadsheetImport_2:PerCwt |
Beanshell_2:PerCwt |
SpreadsheetImport_2:Production |
Beanshell_2:Production |
SpreadsheetImport_2:Total |
Beanshell_2:Total |
SpreadsheetImport_2:Year |
Beanshell_2:Year |
SpreadsheetImport_2:Yield |
Beanshell_2:Yield |
GenerateGraphURL_2:graphURL |
Get_Image_From_URL_2:url |
GenerateGraphURL:graphURL |
Get_Image_From_URL_2:url |
Get_Image_From_URL_2:image |
graph |
Uploader
License
All versions of this Workflow are
licensed under:
Version 1
(of 1)
Credits (2)
(People/Groups)
Attributions (0)
(Workflows/Files)
None
Shared with Groups (1)
Featured In Packs (0)
None
Log in to add to one of your Packs
Attributed By (0)
(Workflows/Files)
None
Favourited By (0)
No one
Statistics
Other workflows that use similar services
(0)
There are no workflows in myExperiment that use similar services to this Workflow.
Comments (0)
No comments yet
Log in to make a comment