Error bars in BarChart3D

Following the page on error bars in charts I wanted to make a BarChart3d with error bars, but I'm struggling with it because there is no help about the function "ChartElementData", which is used to add the error bars to the plot. To be more specific:

Data is of the form:

{3.6970967741935485 -> 1.2448175747118455,  9.7975 -> 1.3853284164516986, ...}

The following function is defined on the page:

errorBar[type_: "Rectangle"][{{x0_, x1_}, {y0_, y1_}}, value_, meta_] :=
Block[{error}, error = Flatten[meta];
error = If[error === {}, 0, Last[error]];
{ChartElementData[type][{{x0, x1}, {y0, y1}}, value, meta],
{Black, Line[{{{(x0 + x1)/2, y1 - error}, {(x0 + x1)/2,
y1 + error}}, {{1/4 (3 x0 + x1),
y1 + error}, {1/4 (x0 + 3 x1),
y1 + error}}, {{1/4 (3 x0 + x1),
y1 - error}, {1/4 (x0 + 3 x1), y1 - error}}}]}}]

After that, plotting

BarChart[chartData, ChartElementFunction -> errorBar["Rectangle"]]
BarChart3D[chartData, ChartElementFunction -> errorBar["Cone"]]

gives the right 2D plot, and the 3D plot shows the error bars, but not the data bars! I understand that I have to fix the points in the Line command for the 3D case, but the error Mathematica shows is regarding the "type" variable passed to ChartElementData:

FEPrivateIf is not a Graphics3D primitive or directive. BarFunctionDumpConeBar3D is not a Graphics3D primitive or directive.

Similar thing happens with

BarChart3D[chartData, ChartElementFunction -> errorBar[Cone[]]]

How can I get back the data bars?

The two commands

BarChart[chartData]
BarChart3D[chartData]

work fine, as expected.

• You need to use a function set up for 3D. See this example in the documentation for the correct form of the function. Nov 17 '15 at 19:19

This worked for me at the end:

errorBar3D[b : {{x0_, x1_}, {y0_, y1_}, {z0_, z1_}}, value_, meta_] :=
Block[{error}, error = Flatten[meta];
error = If[error === {}, 0,
Last[error]]; {ChartElementDataFunction["Cylinder",
"Profile" -> 2][b], {Black, Opacity[0.7],
Line[{{{(x0 + x1)/2, (y0 + y1)/2,
z1 - error}, {(x0 + x1)/2, (y0 + y1)/2,
z1 + error}}, {{1/4 (3 x0 + x1), (y0 + y1)/2,
z1 + error}, {1/4 (x0 + 3 x1), (y0 + y1)/2,
z1 + error}}, {{1/4 (3 x0 + x1), (y0 + y1)/2,
z1 - error}, {1/4 (x0 + 3 x1), (y0 + y1)/2, z1 - error}}}]}}]