ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  3D with multiple datasets in same BarLayer
Posted by Karl on Jan-09-2013 22:07
Attachments:
Dear Peter,

if i create a barchart with more than 1 dataset in 1 Barlayer, overlap the bars and set3d(), than the result looks a bit weird (see picture).

Here my code:
BarLayer barLayer = c.addBarLayer2(Chart.Side);
barLayer.addDataSet(data0,0x808080, "Server # 1");
barLayer.addDataSet(data1,0x80ff00, "Server # 2");
barLayer.addDataSet(data2,0x8000ff, "Server # 3");
barLayer.setOverlapRatio(0.5);
barLayer.set3D();

The overlap works fine  for 2D.
(without "barLayer.set3D();")

(By the way: The adjusted code for LineBars woks:
LineLayer lineLayer = c.addLineLayer();
lineLayer.addDataSet(data0,0x808080, "Server # 1");
lineLayer.addDataSet(data1,0x80ff00, "Server # 2");
lineLayer.addDataSet(data2,0x8000ff, "Server # 3");
lineLayer.set3D(12);
)


Any workaround ?
Overlapping_bars.jpg

  Re: 3D with multiple datasets in same BarLayer
Posted by Peter Kwan on Jan-10-2013 03:31
Hi Karl,

ChartDirector currently does not support overlapping 3D bars on the same layer. Overlapping 3D bars in the same layer are in fact "intersecting solids", where one solid goes into another solid, and this is not supported.

Even in a real world, it is hard to see how one can move two solid bars together in the same layer, to the extent that they overlap (go into each other). It is possible to do so in different layers (something like the "Depth Bar Chart" sample code). It is like (code is assumed to be in Java):

//all your data
double[][] allData = {data0, data1, data2};
int[] allColors = {0x808080, 0x80ff00, 0x8000ff};
String[] allNames = {"Server # 1", "Server # 2", "Server # 3"};

for (int i = 0; i < allData.length; ++i) {
   BarLayer barLayer = c.addBarLayer2(Chart.Side);
   barLayer.setOverlapRatio(0.5);
   barLayer.set3D();
   for (int j = 0; j < allData.length; ++i) {
        if (i == j) barLayer.addDataSet(allData[i], allColors[i], allNames[i]);
        else barLayer.addDataSet(new double[] {}, Chart.Transparent);
   }
}

Hope this can help.

Regards
Peter Kwan