本文整理汇总了Java中com.vaadin.addon.charts.model.style.SolidColor类的典型用法代码示例。如果您正苦于以下问题:Java SolidColor类的具体用法?Java SolidColor怎么用?Java SolidColor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SolidColor类属于com.vaadin.addon.charts.model.style包,在下文中一共展示了SolidColor类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addItem
import com.vaadin.addon.charts.model.style.SolidColor; //导入依赖的package包/类
public void addItem(Number value, String itemName, SolidColor color, String groupName) {
GroupedDataSeriesItem outerItem = findItem(itemName, groupName);
if (outerItem != null) {
// update the existing item
outerItem.setY(value);
outerItem.setColor(color);
// remember updated items
updatedItems.add(new ColumnCoupleKey<String, String>(outerItem.getGroupName(), outerItem.getName()));
} else {
// add a new item to the ring
outerItem = new GroupedDataSeriesItem(itemName, value, color, groupName);
// adding new item won't work without this
outerItem.setX(0);
// redraw the complete chart if anything was added, highcharts lib doesn't
// handle render changes correctly
setRedrawNeeded();
}
getUnrenderedData().add(outerItem);
}
示例2: renderChart
import com.vaadin.addon.charts.model.style.SolidColor; //导入依赖的package包/类
@Override
protected void renderChart(Map data) {
itemsManager.beginUpdate();
Set<Map.Entry> entries = data.entrySet();
for (Map.Entry entry : entries) {
Object column = entry.getKey();
Object value = entry.getValue();
// Assume that the column could be either numeric or text
// and values are always numeric
String columnLabel = column.toString();
Number valueNum = (Number) value;
// draw the item
SolidColor color = chartColorer.lookupColor(columnLabel);
itemsManager.addItem(valueNum, columnLabel, color);
}
// render all items
itemsManager.renderItems();
// save changes in values colors back to the preference
setPreferenceValue(DiagrammePreference.VALUE_COLOUR_MAP, chartColorer.getValueColourMap());
}
示例3: DonutChart
import com.vaadin.addon.charts.model.style.SolidColor; //导入依赖的package包/类
public DonutChart(Container container) {
super(container);
innerItemsManager = new SimpleDataSeriesManager();
outerItemsManager = new GroupedDataSeriesManager();
// Setup outer ring
PlotOptionsPie outerOptions = new PlotOptionsPie();
outerOptions.setInnerSize(200);
outerOptions.setSize("80%");
outerItemsManager.getSeries().setPlotOptions(outerOptions);
outerOptions.setBorderWidth(0.5);
// Setup inner aggregation ring
PlotOptionsPie innerOptions = new PlotOptionsPie();
innerOptions.setSize(200);
innerItemsManager.getSeries().setPlotOptions(innerOptions);
innerOptions.setDataLabels(new Labels());
innerOptions.getDataLabels().setFormatter("this.y > 5 ? this.point.name : null");
innerOptions.getDataLabels().setColor(new SolidColor(255, 255, 255));
innerOptions.getDataLabels().setDistance(-35);
innerOptions.setBorderWidth(0.5);
getConfiguration().setSeries(innerItemsManager.getSeries(), outerItemsManager.getSeries());
}
示例4: renderChart
import com.vaadin.addon.charts.model.style.SolidColor; //导入依赖的package包/类
@Override
protected void renderChart(Map data) {
String[] categoriesNames = getCategoriesNames(data.keySet());
getConfiguration().getxAxis().setCategories(categoriesNames);
pointsManager.beginUpdate();
// Store series data in an array
Iterator it = data.keySet().iterator();
Number[] values = new Number[data.size()];
int i = 0;
while (it.hasNext()) {
Object firstColumnValue = it.next();
Number value = (Number) data.get(firstColumnValue);
if (value == null) {
value = 0;
}
values[i] = value;
i++;
}
AbstractPlotOptions options = getOptions();
SolidColor color = chartColorer.lookupColor(CHART_VALUES);
options.setColor(color);
pointsManager.addPoint(values, CHART_VALUES, options);
// render all items
pointsManager.renderPoints();
// save changes in values colors back to the preference
setPreferenceValue(DiagrammePreference.VALUE_COLOUR_MAP, chartColorer.getValueColourMap());
}
示例5: createPlotBands
import com.vaadin.addon.charts.model.style.SolidColor; //导入依赖的package包/类
private PlotBand[] createPlotBands() {
PlotBand[] plotBands = new PlotBand[plotBandList.size()];
for (int i = 0; i < plotBandList.size(); i++) {
PlotBandPreference plot = plotBandList.get(i);
int[] col = ColourUtil.decode(plot.getColor());
plotBands[i] = new PlotBand(plot.getStartValue(), plot.getEndValue(), new SolidColor(col[0], col[1], col[2]));
}
return plotBands;
}
示例6: generateNewColor
import com.vaadin.addon.charts.model.style.SolidColor; //导入依赖的package包/类
public static SolidColor generateNewColor(int colorIndex){
Random r = new Random(colorIndex);
int red = r.nextInt(255);
int green = r.nextInt(255);
int blue = r.nextInt(255);
return new SolidColor(red, green, blue);
}
示例7: fillTable
import com.vaadin.addon.charts.model.style.SolidColor; //导入依赖的package包/类
private void fillTable() {
colorTable.removeAllItems();
int rowIndex = 0;
final Map<String, String> valueColourMap = getPreferenceValue(DiagrammePreference.VALUE_COLOUR_MAP, preferences);
Iterator<Map.Entry<String, String>> it = valueColourMap.entrySet().iterator();
while (it.hasNext()) {
final Map.Entry<String, String> entry = it.next();
int[] d = ColourUtil.decode(entry.getValue());
final Color c = new SolidColor(d[0], d[1], d[2]);
ColorPicker picker = new ColorPicker();
picker.setColor(new com.vaadin.shared.ui.colorpicker.Color(ColourUtil.decode(c.toString())[0],
ColourUtil.decode(c.toString())[1], ColourUtil.decode(c.toString())[2]));
picker.setPosition(Page.getCurrent().getBrowserWindowWidth() / 2 - 246 / 2,
Page.getCurrent().getBrowserWindowHeight() / 2 - 507 / 2);
picker.addColorChangeListener(new ColorChangeListener() {
@Override
public void colorChanged(ColorChangeEvent event) {
valueColourMap.put(entry.getKey(), event.getColor().getCSS());
preferences.getItemDataSource().getItemProperty(DiagrammePreference.VALUE_COLOUR_MAP).setValue(valueColourMap);
// chartLayout.getConfigurationLayout().getLookAndFeelLayout().renderChart();
}
});
colorTable.addItem(new Object[]{entry.getKey(), picker}, rowIndex);
rowIndex++;
}
}
示例8: renderChart
import com.vaadin.addon.charts.model.style.SolidColor; //导入依赖的package包/类
@Override
protected void renderChart(Map<ColumnCoupleKey<?, ?>, Object> data,
Set secondColumnValues, Set firstColumnValues) {
String[] categoriesNames = getCategoriesNames(firstColumnValues);
getConfiguration().getxAxis().setCategories(categoriesNames);
pointsManager.beginUpdate();
for (Object secondColumnValue : secondColumnValues) {
String secondColumnText = secondColumnValue.toString();
// Store series data in an array
Number[] groupedValues = new Number[firstColumnValues.size()];
Iterator it = firstColumnValues.iterator();
int i = 0;
while (it.hasNext()) {
Object firstColumnValue = it.next();
Number value = (Number) data.get(new ColumnCoupleKey(secondColumnValue, firstColumnValue));
if (value == null) {
value = 0;
}
groupedValues[i] = value;
i++;
}
AbstractPlotOptions options = getOptions();
SolidColor color = chartColorer.lookupColor(secondColumnText);
options.setColor(color);
pointsManager.addPoint(groupedValues, secondColumnText, options);
}
// render all items
pointsManager.renderPoints();
// save changes in values colors back to the preference
setPreferenceValue(DiagrammePreference.VALUE_COLOUR_MAP, chartColorer.getValueColourMap());
}
示例9: buildSparkline
import com.vaadin.addon.charts.model.style.SolidColor; //导入依赖的package包/类
private Component buildSparkline(final int[] values, final Color color) {
Chart spark = new Chart();
spark.getConfiguration().setTitle("");
spark.getConfiguration().getChart().setType(ChartType.LINE);
spark.getConfiguration().getChart().setAnimation(false);
spark.setWidth("120px");
spark.setHeight("40px");
DataSeries series = new DataSeries();
for (int i = 0; i < values.length; i++) {
DataSeriesItem item = new DataSeriesItem("", values[i]);
series.add(item);
}
spark.getConfiguration().setSeries(series);
spark.getConfiguration().getTooltip().setEnabled(false);
Configuration conf = series.getConfiguration();
Legend legend = new Legend();
legend.setEnabled(false);
conf.setLegend(legend);
Credits c = new Credits("");
spark.getConfiguration().setCredits(c);
PlotOptionsLine opts = new PlotOptionsLine();
opts.setAllowPointSelect(false);
opts.setColor(color);
opts.setDataLabels(new Labels(false));
opts.setLineWidth(1);
opts.setShadow(false);
opts.setDashStyle(DashStyle.SOLID);
opts.setMarker(new Marker(false));
opts.setEnableMouseTracking(false);
opts.setAnimation(false);
spark.getConfiguration().setPlotOptions(opts);
XAxis xAxis = spark.getConfiguration().getxAxis();
YAxis yAxis = spark.getConfiguration().getyAxis();
SolidColor transparent = new SolidColor(0, 0, 0, 0);
xAxis.setLabels(new Labels(false));
xAxis.setTickWidth(0);
xAxis.setLineWidth(0);
yAxis.setTitle(new Title(""));
yAxis.setAlternateGridColor(transparent);
yAxis.setLabels(new Labels(false));
yAxis.setLineWidth(0);
yAxis.setGridLineWidth(0);
return spark;
}
示例10: getColourList
import com.vaadin.addon.charts.model.style.SolidColor; //导入依赖的package包/类
public static SolidColor[] getColourList(){
return predefinedColours;
}
示例11: getNextColour
import com.vaadin.addon.charts.model.style.SolidColor; //导入依赖的package包/类
public static SolidColor getNextColour(int i){
if(i < predefinedColours.length){
return predefinedColours[i];
}
return generateNewColor(i);
}
示例12: updateSalePieData
import com.vaadin.addon.charts.model.style.SolidColor; //导入依赖的package包/类
private void updateSalePieData() {
final Configuration conf = chart.getConfiguration();
conf.setSeries(newArrayList());
final EntityManager em = lookup(EntityManager.class);
final CriteriaBuilder cb = em.getCriteriaBuilder();
final CriteriaQuery<Tuple> cq = cb.createTupleQuery();
final Root<Sale> root = cq.from(Sale.class);
final Path<Sale.Status> saleStatus = root.get(Sale_.status);
final Expression<Long> saleCount = cb.count(saleStatus);
cq.multiselect(saleStatus, saleCount);
cq.groupBy(saleStatus);
// cq.orderBy(cb.desc(saleStatus));
applyFilters(cb, cq, root);
final TypedQuery<Tuple> tq = em.createQuery(cq);
final DataSeries series = new DataSeries("Продажи");
for (final Tuple t : tq.getResultList()) {
final Sale.Status statusEn = t.get(saleStatus);
final Long countL = t.get(saleCount);
final DataSeriesItem item = new DataSeriesItem();
item.setY(countL);
if (statusEn == Sale.Status.NEW) {
item.setName("Открытые");
item.setColor(new SolidColor("#308FEF"));
} else if (statusEn == Sale.Status.FINISHED) {
item.setName("Завершенные");
item.setColor(new SolidColor("#97DE58"));
item.setSliced(true);
item.setSelected(true);
} else {
item.setName("Отмененные");
item.setColor(new SolidColor("#EB6464"));
}
series.add(item);
}
conf.addSeries(series);
chart.drawChart();
}