Skip to content
Snippets Groups Projects
Commit 8f6d7040 authored by Tim Molter's avatar Tim Molter
Browse files

check for String x-axis value types and throw excpetion if it is NOT a bar chart type

parent 83cde01d
No related branches found
No related tags found
No related merge requests found
...@@ -26,6 +26,7 @@ import java.util.List; ...@@ -26,6 +26,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import com.xeiam.xchart.Series; import com.xeiam.xchart.Series;
import com.xeiam.xchart.StyleManager.ChartType;
import com.xeiam.xchart.internal.chartpart.Axis.AxisType; import com.xeiam.xchart.internal.chartpart.Axis.AxisType;
import com.xeiam.xchart.internal.style.SeriesColorMarkerLineStyleCycler; import com.xeiam.xchart.internal.style.SeriesColorMarkerLineStyleCycler;
...@@ -46,7 +47,7 @@ public class AxisPair implements ChartPart { ...@@ -46,7 +47,7 @@ public class AxisPair implements ChartPart {
/** /**
* Constructor * Constructor
* *
* @param the parent chartPainter * @param the parent chartPainter
*/ */
public AxisPair(ChartPainter chartPainter) { public AxisPair(ChartPainter chartPainter) {
...@@ -93,6 +94,9 @@ public class AxisPair implements ChartPart { ...@@ -93,6 +94,9 @@ public class AxisPair implements ChartPart {
xAxis.setAxisType(AxisType.Date); xAxis.setAxisType(AxisType.Date);
} }
else if (dataPoint instanceof String) { else if (dataPoint instanceof String) {
if (getChartPainter().getStyleManager().getChartType() != ChartType.Bar) {
throw new RuntimeException("X-Axis data types of String can only be used for Bar Charts!!!");
}
xAxis.setAxisType(AxisType.String); xAxis.setAxisType(AxisType.String);
} }
else { else {
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/** /**
* Classes in this package are internal and are not intended to be accessed directly. Therefore, they are not included in the JavaDocs. * Classes in this package are internal and are not intended to be accessed directly. Therefore, they are not included in the JavaDocs.
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment