
org.snpeff.stats.plot.GoogleLineChart Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of SnpEff Show documentation
Show all versions of SnpEff Show documentation
Variant annotation and effect prediction package.
The newest version!
package org.snpeff.stats.plot;
import java.util.ArrayList;
public class GoogleLineChart {
boolean stacked = false;
int width = 1200, height = 800;
String title = "";
String vAxis = "";
String hAxis = "";
ArrayList columnTitltes;
ArrayList xLables;
ArrayList> columns;
String id;
public GoogleLineChart(String title) {
this.title = title;
init();
}
public GoogleLineChart(String title, int width, int height) {
this.title = title;
this.width = width;
this.height = height;
init();
}
public void addColumn(String colTitle, ArrayList columnValues) {
columns.add(columnValues);
columnTitltes.add(colTitle);
}
public void addColumn(String colTitle, int columnValues[]) {
// Convert to string
ArrayList columnValuesStr = new ArrayList();
for (int cv : columnValues)
columnValuesStr.add("" + cv);
columns.add(columnValuesStr);
columnTitltes.add(colTitle);
}
String getValue(int i, int j) {
if (j >= columns.size()) return null;
ArrayList col = columns.get(j);
if (i >= col.size()) return null;
return col.get(i);
}
String getXLabel(int idx) {
if (idx >= xLables.size()) return null;
return xLables.get(idx);
}
void init() {
columnTitltes = new ArrayList();
xLables = new ArrayList();
columns = new ArrayList>();
id = "chart_" + (Double.toString(Math.random()).substring(2));
}
/**
* Max column length
* @return
*/
int maxColumnLength() {
int size = 0;
for (int i = 0; i < columns.size(); i++)
size = Math.max(size, columns.get(i).size());
return size;
}
public void sethAxis(String hAxis) {
this.hAxis = hAxis;
}
public void setHeight(int height) {
this.height = height;
}
public void setStacked(boolean stacked) {
this.stacked = stacked;
}
public void setTitle(String title) {
this.title = title;
}
public void setvAxis(String vAxis) {
this.vAxis = vAxis;
}
public void setWidth(int width) {
this.width = width;
}
public void setxLables(ArrayList xLables) {
this.xLables = xLables;
}
public String toStringHtmlBody() {
StringBuilder sb = new StringBuilder();
sb.append("\n");
return sb.toString();
}
public String toStringHtmlHeader() {
StringBuilder sb = new StringBuilder();
sb.append("");
sb.append("\n");
sb.append("\n");
sb.append("\n");
return sb.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy