本文整理汇总了Java中com.googlecode.gwt.charts.client.DataTable类的典型用法代码示例。如果您正苦于以下问题:Java DataTable类的具体用法?Java DataTable怎么用?Java DataTable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataTable类属于com.googlecode.gwt.charts.client包,在下文中一共展示了DataTable类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: draw
import com.googlecode.gwt.charts.client.DataTable; //导入依赖的package包/类
private void draw() {
JsArrayMixed dataArray = JsonUtils.unsafeEval("[['Mon',20,28,38,45],['Tue',31,38,55,66],['Wed',50,55,77,80],['Thu',77,77,66,50],['Fri',68,66,22,15]]");
// Prepare the data
DataTable dataTable = ChartHelper.arrayToDataTable(dataArray, true);
// Set options
CandlestickChartOptions options = CandlestickChartOptions.create();
BackgroundColor bgColor = BackgroundColor.create();
bgColor.setStroke("#2196f3");
bgColor.setFill("#90caf9");
bgColor.setStrokeWidth(2);
options.setLegend(Legend.create(LegendPosition.NONE));
options.setFallingColor(bgColor);
options.setRisingColor(bgColor);
// Draw the chart
chart.draw(dataTable, options);
}
开发者ID:GwtMaterialDesign,项目名称:gwt-material-demo,代码行数:23,代码来源:MaterialCandleStick.java
示例2: 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());
}
开发者ID:GwtMaterialDesign,项目名称:gwt-material-demo,代码行数:24,代码来源:MaterialColoredLineChart.java
示例3: 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());
}
开发者ID:GwtMaterialDesign,项目名称:gwt-material-demo,代码行数:25,代码来源:MaterialColoredLineChart.java
示例4: 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());
}
开发者ID:GwtMaterialDesign,项目名称:gwt-material-demo,代码行数:22,代码来源:MaterialBarChart.java
示例5: 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());
}
开发者ID:GwtMaterialDesign,项目名称:gwt-material-demo,代码行数:18,代码来源:MaterialAreaChart.java
示例6: 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);
}
开发者ID:GwtMaterialDesign,项目名称:gwt-material-demo,代码行数:23,代码来源:MaterialGauge.java
示例7: draw
import com.googlecode.gwt.charts.client.DataTable; //导入依赖的package包/类
private void draw() {
JsArrayMixed dataArray = JsonUtils
.unsafeEval("[['Month', 'Bolivia', 'Ecuador', 'Madagascar', 'Papua Guinea', 'Rwanda', 'Average'],['2004/05', 165, 938, 522, 998, 450, 614.6],['2005/06', 135, 1120, 599, 1268, 288, 682],['2006/07', 157, 1167, 587, 807, 397, 623],['2007/08', 139, 1110, 615, 968, 215, 609.4],['2008/09', 136, 691, 629, 1026, 366, 569.6]]");
// Prepare the data
DataTable dataTable = ChartHelper.arrayToDataTable(dataArray);
// Set options
ComboChartOptions options = ComboChartOptions.create();
options.setFontName("Tahoma");
options.setTitle("Monthly Coffee Production by Country");
options.setHAxis(HAxis.create("Cups"));
options.setVAxis(VAxis.create("Month"));
options.setSeriesType(SeriesType.BARS);
ComboChartSeries series = ComboChartSeries.create();
series.setType(SeriesType.LINE);
options.setSeries(5, series);
// Draw the chart
chart.draw(dataTable, options);
}
开发者ID:GwtMaterialDesign,项目名称:gwt-material-demo,代码行数:22,代码来源:MaterialComboCharts.java
示例8: 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());
}
}
开发者ID:armangal,项目名称:SmartMonitoring,代码行数:25,代码来源:MonitoringDynamicLinesChart.java
示例9: 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);
}
开发者ID:WSDOT,项目名称:social-analytics,代码行数:34,代码来源:SourcesPieChart.java
示例10: 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());
}
开发者ID:GwtMaterialDesign,项目名称:gwt-material-demo,代码行数:37,代码来源:MaterialBubbleChart.java
示例11: initializeRegularChart
import com.googlecode.gwt.charts.client.DataTable; //导入依赖的package包/类
private void initializeRegularChart() {
ChartLoader chartLoader = new ChartLoader(ChartPackage.CORECHART);
chartLoader.loadApi(new Runnable() {
@Override
public void run() {
PieChart chart = new PieChart();
chart.setWidth("100%");
chart.setHeight("100%");
cardContent.add(chart);
DataTable dataTable = DataTable.create();
dataTable.addColumn(ColumnType.STRING, "Task");
dataTable.addColumn(ColumnType.NUMBER, "Hours per Day");
dataTable.addRows(5);
dataTable.setValue(0, 0, "Work");
dataTable.setValue(0, 1, 11);
dataTable.setValue(1, 0, "Sleep");
dataTable.setValue(1, 1, 7);
dataTable.setValue(2, 0, "Watch TV");
dataTable.setValue(2, 1, 3);
dataTable.setValue(3, 0, "Eat");
dataTable.setValue(3, 1, 2);
dataTable.setValue(4, 0, "Commute");
dataTable.setValue(4, 1, 1);
PieOpt opt = new PieOpt();
opt.setColors("2196f3", "42a5f5", "64b5f6", "90caf9", "bbdefb");
chart.draw(dataTable, opt.get());
}
});
}
开发者ID:GwtMaterialDesign,项目名称:gwt-material-demo,代码行数:34,代码来源:MaterialPieChart.java
示例12: initializeDonutChart
import com.googlecode.gwt.charts.client.DataTable; //导入依赖的package包/类
private void initializeDonutChart() {
ChartLoader chartLoader = new ChartLoader(ChartPackage.CORECHART);
chartLoader.loadApi(new Runnable() {
@Override
public void run() {
PieChart chart = new PieChart();
chart.setWidth("100%");
chart.setHeight("100%");
cardContent.add(chart);
DataTable dataTable = DataTable.create();
dataTable.addColumn(ColumnType.STRING, "Task");
dataTable.addColumn(ColumnType.NUMBER, "Hours per Day");
dataTable.addRows(5);
dataTable.setValue(0, 0, "Work");
dataTable.setValue(0, 1, 11);
dataTable.setValue(1, 0, "Sleep");
dataTable.setValue(1, 1, 7);
dataTable.setValue(2, 0, "Watch TV");
dataTable.setValue(2, 1, 3);
dataTable.setValue(3, 0, "Eat");
dataTable.setValue(3, 1, 2);
dataTable.setValue(4, 0, "Commute");
dataTable.setValue(4, 1, 1);
PieOpt opt = new PieOpt();
opt.setColors("2196f3", "42a5f5", "64b5f6", "90caf9", "bbdefb");
opt.setHole(0.8);
chart.draw(dataTable, opt.get());
}
});
}
开发者ID:GwtMaterialDesign,项目名称:gwt-material-demo,代码行数:34,代码来源:MaterialPieChart.java
示例13: initialize3DChart
import com.googlecode.gwt.charts.client.DataTable; //导入依赖的package包/类
private void initialize3DChart() {
ChartLoader chartLoader = new ChartLoader(ChartPackage.CORECHART);
chartLoader.loadApi(new Runnable() {
@Override
public void run() {
PieChart chart = new PieChart();
chart.setWidth("100%");
chart.setHeight("100%");
cardContent.add(chart);
DataTable dataTable = DataTable.create();
dataTable.addColumn(ColumnType.STRING, "Task");
dataTable.addColumn(ColumnType.NUMBER, "Hours per Day");
dataTable.addRows(5);
dataTable.setValue(0, 0, "Work");
dataTable.setValue(0, 1, 11);
dataTable.setValue(1, 0, "Sleep");
dataTable.setValue(1, 1, 7);
dataTable.setValue(2, 0, "Watch TV");
dataTable.setValue(2, 1, 3);
dataTable.setValue(3, 0, "Eat");
dataTable.setValue(3, 1, 2);
dataTable.setValue(4, 0, "Commute");
dataTable.setValue(4, 1, 1);
PieOpt opt = new PieOpt();
opt.setColors("2196f3", "42a5f5", "64b5f6", "90caf9", "bbdefb");
opt.setIs3D(true);
chart.draw(dataTable, opt.get());
}
});
}
开发者ID:GwtMaterialDesign,项目名称:gwt-material-demo,代码行数:34,代码来源:MaterialPieChart.java
示例14: 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);
}
开发者ID:GwtMaterialDesign,项目名称:gwt-material-demo,代码行数:32,代码来源:MaterialGeoChart.java
示例15: 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);
}
开发者ID:ratheile,项目名称:sweng15,代码行数:42,代码来源:TableVisualizer.java
示例16: 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);
}
开发者ID:ratheile,项目名称:sweng15,代码行数:38,代码来源:HistogramVisualizer.java
示例17: 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);
}
开发者ID:ratheile,项目名称:sweng15,代码行数:34,代码来源:MovieWorldMapVisualizer.java
示例18: 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);
}
开发者ID:armangal,项目名称:SmartMonitoring,代码行数:29,代码来源:MonitoringPieChart.java
示例19: 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);
}
开发者ID:WSDOT,项目名称:social-analytics,代码行数:60,代码来源:SummaryChart.java
示例20: 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);
}
开发者ID:WSDOT,项目名称:social-analytics,代码行数:60,代码来源:SummaryChart.java
注:本文中的com.googlecode.gwt.charts.client.DataTable类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论