This project (see `./test/simpletest_errorbarstyles/`) simply creates a JKQtPlotter widget (as a new window) and adds several curves show-casing different styles of error indicators. Data is initialized from two QVector<double> objects.
The source code of the main application can be found in [`jkqtplotter_simpletest_errorbarstyles.cpp´](https://github.com/jkriege2/JKQtPlotter/blob/master/test/simpletest_errorbarstyles/jkqtplotter_simpletest_errorbarstyles.cpp).
First some data is added to the internal datastore (mostly, like explained in several other examples, like e.g. [Line Graph with Different Symbols and Line Styles](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_symbols_and_styles)). The (in a loop) several graphs are added, each with a distinct style for its error indicators:
// add the graph to the plot, so it is actually displayed
plot.addGraph(graph);
}
```
The error styles are set in these lines:
```c++
// set error style, for the y-axis
graph->set_yErrorStyle(errorStyles[errorID]);
// no error indicators for the x-values
graph->set_xErrorStyle(errorStyles[errorID]);
```
There are several variables that can be used to further style the error indicator, like:
```c++
// make error indicator 30% transparent
QColor c=graph->get_errorFillColor();
c.setAlphaF(0.3);
graph->set_errorFillColor(c);
// set error indicator line width
graph->set_errorWidth(1);
// set length of small bars at the end of error bars
graph->set_errorbarSize(15);
```
There are more properties that you can find in the documentation of the mix-in classes `JKQTPxyGraphErrors`, `JKQTPxGraphErrors`, `JKQTPyGraphErrors`, `JKQTPgraphErrors`.
In addition the plot key is moved outside the pot and the grid in the plot is switched off:
Error bars are implemented in the mixin-classes `JKQTPxyGraphErrors`, `JKQTPxGraphErrors` and `JKQTPyGraphErrors` that are all derived from `JKQTPgraphErrors`. With these it is simple to add error indicators to several different plot styles. Usually you can recognize these by looking at the class name, e.g. `JKQTPxyLineGraph` is a simple line+symbol graph, and `JKQTPxyLineErrorGraph` is the same with error indictaors (see above). There are also several other plots with error indicators:
-`JKQTPbarVerticalErrorGraph` for barcharts with errors:<br>![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_errorbarstyles_barcharts.png)
-`JKQTPimpulsesVerticalGraph` for impulse/candle-stick charts with errors:<br>![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_errorbarstyles_impulses.png)
-`JKQTPfilledCurveXErrorGraph` for filled curves with errors:<br>![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_errorbarstyles_filledcurves.png)
.
[Back to JKQTPlotter main page](https://github.com/jkriege2/JKQtPlotter/)