diff --git a/README.md b/README.md index b356a1cf..ce7ea9ec 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,7 @@ repaint. * [x] Area charts * [x] Step Area charts * [x] Bar charts +* [x] Horizontal bar charts * [x] Histogram charts * [x] Pie charts * [x] Donut charts @@ -151,17 +152,18 @@ repaint. Currently, there are 5 major chart types. Each type has its corresponding `ChartBuilder`, `Styler` and `Series`. -| Chart Type | Builder | Styler | Series | Allowed Data Types | Default Series Render Style | -|---------------|----------------------|----------------|----------------|----------------------|-----------------------------| -| XYChart | XYChartBuilder | XYStyler | XYSeries | Number, Date | Line | -| CategoryChart | CategoryChartBuilder | CategoryStyler | CategorySeries | Number, Date, String | Bar | -| PieChart | PieChartBuilder | PieStyler | PieSeries | String | Pie | -| BubbleChart | BubbleChartBuilder | BubbleStyler | BubbleSeries | Number, Date | Round | -| DialChart | DialChartBuilder | DialStyler | DialSeries | double | Round | -| RadarChart | RadarChartBuilder | RadarStyler | RadarSeries | double[] | Round | -| OHLCChart | OHLCChartBuilder | OHLCStyler | OHLCSeries | OHLC with Date | Candle | -| BoxChart | BoxChartBuilder | BoxStyler | BoxSeries | Number, Date, String | Box | -| HeatMapChart | HeatMapChartBuilder | HeatMapStyler | HeatMapSeries | Number, Date, String | -- | +| Chart Type | Builder | Styler | Series | Allowed Data Types | Default Series Render Style | +|--------------------|---------------------------|---------------------|---------------------|----------------------|-----------------------------| +| XYChart | XYChartBuilder | XYStyler | XYSeries | Number, Date | Line | +| CategoryChart | CategoryChartBuilder | CategoryStyler | CategorySeries | Number, Date, String | Bar | +| PieChart | PieChartBuilder | PieStyler | PieSeries | String | Pie | +| BubbleChart | BubbleChartBuilder | BubbleStyler | BubbleSeries | Number, Date | Round | +| DialChart | DialChartBuilder | DialStyler | DialSeries | double | Round | +| RadarChart | RadarChartBuilder | RadarStyler | RadarSeries | double[] | Round | +| OHLCChart | OHLCChartBuilder | OHLCStyler | OHLCSeries | OHLC with Date | Candle | +| BoxChart | BoxChartBuilder | BoxStyler | BoxSeries | Number, Date, String | Box | +| HeatMapChart | HeatMapChartBuilder | HeatMapStyler | HeatMapSeries | Number, Date, String | -- | +| HorizontalBarChart | HorizontalBarChartBuilder | HorizontalBarStyler | HorizontalBarSeries | Number, Date, String | Bar | The different Stylers contain chart styling methods specific to the corresponding chart type as well as common styling methods common across all chart types. @@ -284,6 +286,16 @@ An example of a set of sequence numbers: 12, 15, 17, 19, 20, 23, 25, 28, 30, 33, `HeatMapChart` take Date, Number or String data types for the X-Axis, Y-Axis. +### HorizontalBarChart + +![](https://raw.githubusercontent.com/knowm/XChart/develop/etc/XChart_HorizontalBarChart.png) + +`HorizontalBarChart` charts take Date, Number or String data types for the Y-Axis and Number data types for the X-Axis. For the Y-Axis, each category is given its own tick mark. + +It supports `labels` and `tooltips`, but more advanced features like `error bars` or `stacking` are not yet implemented. + +Series render style is `Bar`. + ## Real-time Java Charts using XChart ![](https://raw.githubusercontent.com/knowm/XChart/develop/etc/XChart_SimpleRealtime.gif) diff --git a/xchart-demo/src/main/java/org/knowm/xchart/demo/charts/horizontalbar/HorizontalBarChart01.java b/xchart-demo/src/main/java/org/knowm/xchart/demo/charts/horizontalbar/HorizontalBarChart01.java new file mode 100644 index 00000000..a807a85b --- /dev/null +++ b/xchart-demo/src/main/java/org/knowm/xchart/demo/charts/horizontalbar/HorizontalBarChart01.java @@ -0,0 +1,61 @@ +package org.knowm.xchart.demo.charts.horizontalbar; + +import org.knowm.xchart.HorizontalBarChart; +import org.knowm.xchart.HorizontalBarChartBuilder; +import org.knowm.xchart.SwingWrapper; +import org.knowm.xchart.demo.charts.ExampleChart; +import org.knowm.xchart.style.Styler.LegendPosition; + +import java.util.Arrays; + +/** + * Basic Horizontal Bar Chart + * + *

Demonstrates the following: + * + *