
org.pepstock.charba.client.StackedBarChart Maven / Gradle / Ivy
/**
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
package org.pepstock.charba.client;
import org.pepstock.charba.client.configuration.StackedBarOptions;
import org.pepstock.charba.client.data.BarDataset;
import org.pepstock.charba.client.data.BubbleDataset;
import org.pepstock.charba.client.data.Dataset;
import org.pepstock.charba.client.data.LineDataset;
import org.pepstock.charba.client.data.ScatterDataset;
import org.pepstock.charba.client.data.StackedBarDataset;
/**
* STACKED BAR chart implementation.
* Stacked bar charts can be configured like bar charts and changes the settings on the X and Y axes to enable stacking.
* Stacked bar charts can be used to show how one data series is made up of a number of smaller pieces.
*
* @author Andrea "Stock" Stocchero
*
*/
public class StackedBarChart extends AbstractChart implements IsDatasetCreator, HasCartesianAxes {
private final StackedBarOptions options;
/**
* Builds the object.
*/
public StackedBarChart() {
this(ChartType.BAR);
}
/**
* Builds the chart.
* This is must be extended for controller which are based on this type of chart.
*
* @param extendedType type of chart
*/
protected StackedBarChart(Type extendedType) {
super(extendedType);
// creates the options
options = new StackedBarOptions(this, getDefaultChartOptions());
}
/*
* (non-Javadoc)
*
* @see org.pepstock.charba.client.IsChart#getOptions()
*/
@Override
public StackedBarOptions getOptions() {
return options;
}
/*
* (non-Javadoc)
*
* @see org.pepstock.charba.client.AbstractChart#newDataset(boolean)
*/
@Override
public StackedBarDataset newDataset(boolean hidden) {
return new StackedBarDataset(getDefaultChartOptions(), hidden);
}
/*
* (non-Javadoc)
*
* @see org.pepstock.charba.client.AbstractChart#checkDataset(org.pepstock.charba.client.data.Dataset)
*/
@Override
protected boolean checkDataset(Dataset dataset) {
return dataset instanceof BarDataset || dataset instanceof LineDataset || dataset instanceof BubbleDataset || dataset instanceof ScatterDataset;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy