本文整理汇总了Java中com.googlecode.gwt.charts.client.DataTable.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java DataTable.setValue方法的具体用法?Java DataTable.setValue怎么用?Java DataTable.setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.googlecode.gwt.charts.client.DataTable
的用法示例。
在下文中一共展示了DataTable.setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: draw
import com.googlecode.gwt.charts.client.DataTable; //导入方法依赖的package包/类
private void draw() {
String[] countries = new String[] { "Austria", "Bulgaria", "Denmark", "Greece" };
int[] years = new int[] { 2003, 2004, 2005, 2006, 2007, 2008 };
int[][] values = new int[][] { { 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0 } };
// Prepare the data
DataTable dataTable = DataTable.create();
dataTable.addColumn(ColumnType.STRING, "Year");
for (int i = 0; i < countries.length; i++) {
dataTable.addColumn(ColumnType.NUMBER, countries[i]);
}
dataTable.addRows(years.length);
for (int i = 0; i < years.length; i++) {
dataTable.setValue(i, 0, String.valueOf(years[i]));
}
for (int col = 0; col < values.length; col++) {
for (int row = 0; row < values[col].length; row++) {
dataTable.setValue(row, col + 1, values[col][row]);
}
}
chart.draw(dataTable, getOptions());
}
示例2: draw2
import com.googlecode.gwt.charts.client.DataTable; //导入方法依赖的package包/类
private void draw2() {
String[] countries = new String[] { "Austria", "Bulgaria", "Denmark", "Greece" };
int[] years = new int[] { 2003, 2004, 2005, 2006, 2007, 2008 };
int[][] values = new int[][] { { 1336060, 1538156, 1576579, 1600652, 1968113, 1901067 }, { 400361, 366849, 440514, 434552, 393032, 517206 }, { 1001582, 1119450, 993360, 1004163, 979198, 916965 }, { 997974, 941795, 930593, 897127, 1080887, 1056036 } };
// Prepare the data
DataTable dataTable = DataTable.create();
dataTable.addColumn(ColumnType.STRING, "Year");
for (int i = 0; i < countries.length; i++) {
dataTable.addColumn(ColumnType.NUMBER, countries[i]);
}
dataTable.addRows(years.length);
for (int i = 0; i < years.length; i++) {
dataTable.setValue(i, 0, String.valueOf(years[i]));
}
for (int col = 0; col < values.length; col++) {
for (int row = 0; row < values[col].length; row++) {
dataTable.setValue(row, col + 1, values[col][row]);
}
}
chart.draw(dataTable, getOptions());
}
示例3: drawChart
import com.googlecode.gwt.charts.client.DataTable; //导入方法依赖的package包/类
private void drawChart(int[][] values) {
// Prepare the data
DataTable dataTable = DataTable.create();
dataTable.addColumn(ColumnType.STRING, "Year");
for (int i = 0; i < countries.length; i++) {
dataTable.addColumn(ColumnType.NUMBER, countries[i]);
}
dataTable.addRows(years.length);
for (int i = 0; i < years.length; i++) {
dataTable.setValue(i, 0, String.valueOf(years[i]));
}
for (int col = 0; col < values.length; col++) {
for (int row = 0; row < values[col].length; row++) {
dataTable.setValue(row, col + 1, values[col][row]);
}
}
// Draw the chart
chart.draw(dataTable, getOptions());
}
示例4: drawChart
import com.googlecode.gwt.charts.client.DataTable; //导入方法依赖的package包/类
private void drawChart(int[][] values) {
DataTable dataTable = DataTable.create();
dataTable.addColumn(ColumnType.STRING, "Year");
for (int i = 0; i < countries.length; i++) {
dataTable.addColumn(ColumnType.NUMBER, countries[i]);
}
dataTable.addRows(months.length);
for (int i = 0; i < months.length; i++) {
dataTable.setValue(i, 0, months[i]);
}
for (int col = 0; col < values.length; col++) {
for (int row = 0; row < values[col].length; row++) {
dataTable.setValue(row, col + 1, values[col][row]);
}
}
chart.draw(dataTable, getOptions());
}
示例5: draw
import com.googlecode.gwt.charts.client.DataTable; //导入方法依赖的package包/类
private void draw() {
// Prepare the data
DataTable dataTable = DataTable.create();
dataTable.addColumn(ColumnType.STRING, "LabelStyle");
dataTable.addColumn(ColumnType.NUMBER, "Value");
dataTable.addRows(3);
dataTable.setValue(0, 0, "Memory");
dataTable.setValue(0, 1, 80);
// Set options
GaugeOptions options = GaugeOptions.create();
options.setGreenFrom(0);
options.setGreenTo(40);
options.setYellowFrom(40);
options.setYellowTo(80);
options.setRedFrom(80);
options.setRedTo(100);
// Draw the chart
gauge.draw(dataTable, options);
}
示例6: drawLine
import com.googlecode.gwt.charts.client.DataTable; //导入方法依赖的package包/类
private void drawLine(ChartFeed<V, X> chartFeeds, ILineType lineType, DataTable dataTable) {
@SuppressWarnings("unchecked")
V prevNormalValue = (V) new Integer(Integer.MIN_VALUE);
Log.debug("Adding line:" + lineType.getName() + ":" + lineType.getIndex() + " with values:" + chartFeeds.getValuesLenght());
// Log.debug("Data:" + Arrays.toString(chartFeeds.getValues()[lineType.getIndex()]));
for (int i = 0; i < chartFeeds.getValuesLenght(); i++) {
V value = chartFeeds.getValues(lineType.getIndex(), i);
if (value.intValue() == Integer.MIN_VALUE) {
// this case means that this line do not have valid value for current "period" or "Y"
if (prevNormalValue.intValue() != Integer.MIN_VALUE) {
// draw previous value is case it's valid one, we're OK to start drawing the line from a
// middle of the chart
dataTable.setValue(i, lineType.getIndex() + 1, prevNormalValue.doubleValue());
}
continue;
}
prevNormalValue = value;
dataTable.setValue(i, lineType.getIndex() + 1, value.doubleValue());
}
}
示例7: drawPieChart
import com.googlecode.gwt.charts.client.DataTable; //导入方法依赖的package包/类
/**
* Updates the pue chart with new data
* @param sourcesSummary
*/
private static void drawPieChart(JsArray<SourceSummary> sourcesSummary) {
DataTable data = DataTable.create();
data.addColumn(ColumnType.STRING, "Client");
data.addColumn(ColumnType.NUMBER, "Count");
data.addRows(sourcesSummary.length());
int j = sourcesSummary.length();
for (int i = 0; i < j; i++) {
data.setValue(i, 0, sourcesSummary.get(i).getId());
data.setValue(i, 1, sourcesSummary.get(i).getValue());
}
Legend legend = Legend.create();
legend.setPosition(LegendPosition.NONE);
PieChartOptions options = PieChartOptions.create();
options.setWidth(500);
options.setHeight(400);
ChartArea area = ChartArea.create();
area.setTop(50);
area.setLeft(25);
options.setChartArea(area);
options.setLegend(legend);
options.setColors("00796b", "00897b", "009688", "26a69a", "4db6ac", "80cbc4", "b2dfdb");
pieChart.draw(data, options);
}
示例8: draw
import com.googlecode.gwt.charts.client.DataTable; //导入方法依赖的package包/类
private void draw() {
// Prepare the data
DataTable dataTable = DataTable.create();
dataTable.addColumn(ColumnType.STRING, "ID");
dataTable.addColumn(ColumnType.NUMBER, "Life Expectancy");
dataTable.addColumn(ColumnType.NUMBER, "Fertility Rate");
dataTable.addColumn(ColumnType.STRING, "Region");
dataTable.addColumn(ColumnType.NUMBER, "Population");
dataTable.addRows(4);
dataTable.setValue(0, 0, "CAN");
dataTable.setValue(1, 0, "DEU");
dataTable.setValue(2, 0, "DNK");
dataTable.setValue(3, 0, "EGY");
dataTable.setValue(0, 1, 80.66);
dataTable.setValue(1, 1, 79.84);
dataTable.setValue(2, 1, 78.6);
dataTable.setValue(3, 1, 72.73);
dataTable.setValue(0, 2, 1.67);
dataTable.setValue(1, 2, 1.36);
dataTable.setValue(2, 2, 1.84);
dataTable.setValue(3, 2, 2.78);
dataTable.setValue(0, 3, "North America");
dataTable.setValue(1, 3, "Europe");
dataTable.setValue(2, 3, "Europe");
dataTable.setValue(3, 3, "Africa");
dataTable.setValue(0, 4, 33739900);
dataTable.setValue(1, 4, 81902307);
dataTable.setValue(2, 4, 5523095);
dataTable.setValue(3, 4, 79716203);
// Set options
// Draw the chart
chart.draw(dataTable, getOptions());
}
示例9: draw
import com.googlecode.gwt.charts.client.DataTable; //导入方法依赖的package包/类
private void draw() {
// Prepare the data
DataTable dataTable = DataTable.create();
dataTable.addColumn(ColumnType.STRING, "Country");
dataTable.addColumn(ColumnType.NUMBER, "Popularity");
dataTable.addRows(6);
dataTable.setValue(0, 0, "Germany");
dataTable.setValue(0, 1, 200);
dataTable.setValue(1, 0, "United States");
dataTable.setValue(1, 1, 300);
dataTable.setValue(2, 0, "Brazil");
dataTable.setValue(2, 1, 400);
dataTable.setValue(3, 0, "Canada");
dataTable.setValue(3, 1, 500);
dataTable.setValue(4, 0, "France");
dataTable.setValue(4, 1, 600);
dataTable.setValue(5, 0, "RU");
dataTable.setValue(5, 1, 700);
// Set Geo Chart Colors
// Set options
GeoChartOptions options = GeoChartOptions.create();
GeoChartColorAxis geoChartColorAxis = GeoChartColorAxis.create();
geoChartColorAxis.setColors(getNativeArray());
options.setColorAxis(geoChartColorAxis);
options.setDatalessRegionColor("e3f2fd");
// Draw the chart
geoChart.draw(dataTable, options);
}
示例10: draw
import com.googlecode.gwt.charts.client.DataTable; //导入方法依赖的package包/类
/**
* Creates the table visualization, using the Google Charts framework.
*/
private void draw() {
// Create DataTable
DataTable dataTable = DataTable.create();
dataTable.addColumn(ColumnType.STRING, "Title");
dataTable.addColumn(ColumnType.NUMBER, "Year");
dataTable.addColumn(ColumnType.NUMBER, "Length");
dataTable.addColumn(ColumnType.STRING, "Country");
dataTable.addColumn(ColumnType.STRING, "Genre");
dataTable.addColumn(ColumnType.STRING, "Language");
ArrayList<Movie> movieList = movieCollection.getMovies();
dataTable.addRows(movieList.size());
// Populate DataTable
int i = 0;
for (Movie m : movieList) {
dataTable.setValue(i, 0, m.getTitle());
dataTable.setValue(i, 1, m.getYear());
dataTable.setValue(i, 2, m.getLength());
dataTable.setValue(i, 3, m.getCountry().toString());
dataTable.setValue(i, 4, m.getGenre().toString());
dataTable.setValue(i, 5, m.getLanguage().toString());
i++;
}
// Table options
TableOptions options = TableOptions.create();
// Enable row numbering
options.setShowRowNumber(true);
// Enable paging to improve the performance of displaying large tables
options.setAlternatingRowStyle(true);
options.setPage(TablePage.ENABLE);
// Limit the number of displayed movies per page to 100
options.setPageSize(100);
// Draw visualization
table.draw(dataTable, options);
}
示例11: draw
import com.googlecode.gwt.charts.client.DataTable; //导入方法依赖的package包/类
/**
* Creates the histogram visualization, using the Google Charts framework.
*/
private void draw() {
// Create DataTable
DataTable dataTable = DataTable.create();
dataTable.addColumn(ColumnType.STRING, "Title");
dataTable.addColumn(ColumnType.NUMBER, "Length");
ArrayList<Movie> movieList = movieCollection.getMovies();
dataTable.addRows(movieList.size());
// Populate DataTable
int i = 0;
for (Movie m : movieList) {
if (m.getLength() != -1) {
dataTable.setValue(i, 0, m.getTitle());
dataTable.setValue(i, 1, m.getLength());
i++;
}
}
// Histogram options
HistogramOptions options = HistogramOptions.create();
options.setTitle("Duration of films, in minutes");
options.setLegend(Legend.create(LegendPosition.NONE));
options.setColors("#505050");
options.setHeight(425);
ChartArea area = ChartArea.create();
area.setTop(55);
area.setLeft(50);
area.setHeight(300);
options.setChartArea(area);
// Draw visualization
histogram.draw(dataTable, options);
}
示例12: draw
import com.googlecode.gwt.charts.client.DataTable; //导入方法依赖的package包/类
/**
* Creates the world map visualization, using the Google Charts framework.
*/
protected void draw() {
// Create DataTable
DataTable dataTable = DataTable.create();
dataTable.addColumn(ColumnType.STRING, "Country");
dataTable.addColumn(ColumnType.STRING, "Info");
dataTable.addColumn(ColumnType.NUMBER, "Movie Count");
dataTable.addRows(movie.getCountry().size());
// Fill DataTable
int i = 0;
for (String country : movie.getCountry()) {
dataTable.setValue(i, 0, country);
// The getRelevantMovieInfo() method returns all the important information of an individual film,
// which is displayed when the user moves the cursor over the appropriate country
dataTable.setValue(i, 1, movie.getRelevantMovieInfo());
dataTable.setValue(i, 2, 1);
i++;
}
// GeoChart options
GeoChartOptions options = GeoChartOptions.create();
GeoChartColorAxis geoChartColorAxis = GeoChartColorAxis.create();
geoChartColorAxis.setColors("red");
options.setDatalessRegionColor("#EEEEEE");
options.setColorAxis(geoChartColorAxis);
options.setHeight(570);
// Draw visualization
geoChart.draw(dataTable, options);
}
示例13: draw
import com.googlecode.gwt.charts.client.DataTable; //导入方法依赖的package包/类
private void draw() {
// Prepare the data
DataTable dataTable = DataTable.create();
dataTable.addColumn(ColumnType.STRING, "Task");
dataTable.addColumn(ColumnType.NUMBER, "Hours per Day");
dataTable.addRows(2);
dataTable.setValue(0, 0, "Work");
dataTable.setValue(0, 1, 11);
dataTable.setValue(1, 0, "Sleep");
dataTable.setValue(1, 1, 7);
// Set options
PieChartOptions options = PieChartOptions.create();
options.setBackgroundColor("#f0f0f0");
// options.setColors(colors);
options.setFontName("Tahoma");
options.setIs3D(true);
options.setPieResidueSliceColor("#000000");
options.setPieResidueSliceLabel("Others");
options.setSliceVisibilityThreshold(0.1);
options.setTitle("So, how was your day?");
options.setHeight(100);
options.setWidth(100);
// Draw the chart
chart.draw(dataTable, options);
}
示例14: drawTweetsChart
import com.googlecode.gwt.charts.client.DataTable; //导入方法依赖的package包/类
/**
* Creates a chart with the data from tweetSummary
* @param tweetSummary : returned data from server
*/
private static void drawTweetsChart(JsArray<TweetSummary> tweetSummary) {
DataTable data = DataTable.create();
data.addColumn(ColumnType.STRING, "Date");
data.addColumn(ColumnType.NUMBER, "Mentions");
data.addColumn(ColumnType.NUMBER, "Tweets");
data.addRows(tweetSummary.length());
DateTimeFormat fmt = DateTimeFormat.getFormat("MMM d");
DateTimeFormat fmt2 = DateTimeFormat.getFormat("/yyyy/M/d");
int numberOfStatuses = 0;
int numberOfMentions = 0;
for (int i = 0; i < tweetSummary.length(); i++) {
dateArrayList.add(fmt2.format(new Date((long) tweetSummary.get(i).getId())));
data.setValue(i, 0, fmt.format(new Date((long) tweetSummary.get(i).getId())));
data.setValue(i, 1, tweetSummary.get(i).getValue().getMentions());
data.setValue(i, 2, tweetSummary.get(i).getValue().getStatuses());
numberOfStatuses += tweetSummary.get(i).getValue().getStatuses();
numberOfMentions += tweetSummary.get(i).getValue().getMentions();
}
tweetLabel.add(new Label("Mentions: " + numberOfMentions));
tweetLabel.add(new Label("Tweets: " + numberOfStatuses));
// Set options
//Grid Lines
Gridlines lines = Gridlines.create();
lines.setColor("fff");
// Text Positions X and Y Axis
HAxis hAxis = HAxis.create();
hAxis.setSlantedText(true);
VAxis vAxis = VAxis.create();
vAxis.setGridlines(lines);
hAxis.setGridlines(lines);
// Legend
Legend legend = Legend.create();
legend.setPosition(LegendPosition.TOP);
legend.setAligment(LegendAlignment.END);
// Set options
AreaChartOptions options = AreaChartOptions.create();
options.setAreaOpacity(1);
options.setVAxis(vAxis);
options.setHAxis(hAxis);
options.setLegend(legend);
options.setColors("B2DFDB", "4DB6AC");
// Draw the chart
tweetsChart.draw(data, options);
}
示例15: drawFollowersChart
import com.googlecode.gwt.charts.client.DataTable; //导入方法依赖的package包/类
/**
* Creates a chart with the data from followerSummary
* @param followerSummary : returned data from server
*/
private static void drawFollowersChart(JsArray<FollowerSummary> followerSummary) {
DataTable data = DataTable.create();
data.addColumn(ColumnType.STRING, "Date");
data.addColumn(ColumnType.NUMBER, "Followers");
data.addRows(followerSummary.length());
int j = followerSummary.length();
DateTimeFormat fmt = DateTimeFormat.getFormat("MMM d");
for (int i = 0; i < j; i++) {
data.setValue(i, 0, fmt.format(new Date((long) followerSummary.get(i).getId())));
data.setValue(i, 1, followerSummary.get(i).getValue());
}
int startFollowers = followerSummary.get(0).getValue();
int endFollowers = followerSummary.get(j-1).getValue();
float change = ((float)100 * (((float)endFollowers - (float)startFollowers) / (float)startFollowers));
change = Math.round(change * 100)/(float)100;
followersIcon.setIconType((change == 0 ? IconType.TRENDING_FLAT : (change > 0 ? IconType.TRENDING_UP : IconType.TRENDING_DOWN)));
followersIcon.setIconColor((change == 0 ? "blue" : (change > 0 ? "teal" : "deep-orange accent-2")));
followersLabel.setText((change == 0 ? "No change" : Math.abs(change) + "% " + (change > 0 ? "increase" : "decrease") + " in followers from "
+ fmt.format(new Date((long) followerSummary.get(0).getId()))
+ " to " + fmt.format(new Date((long) followerSummary.get(j-1).getId()))));
// Set options
//Grid Lines
Gridlines lines = Gridlines.create();
lines.setColor("fff");
// Text Positions X and Y Axis
HAxis hAxis = HAxis.create();
hAxis.setSlantedText(true);
VAxis vAxis = VAxis.create();
vAxis.setGridlines(lines);
hAxis.setGridlines(lines);
// Legend
Legend legend = Legend.create();
legend.setPosition(LegendPosition.TOP);
legend.setAligment(LegendAlignment.END);
// Set options
AreaChartOptions options = AreaChartOptions.create();
options.setAreaOpacity(1);
options.setVAxis(vAxis);
options.setHAxis(hAxis);
options.setLegend(legend);
options.setColors("B2DFDB");
// Draw the chart
followersChart.draw(data, options);
}