Encopim
Encopim

Reputation: 11

Drawing Graphics3D in TeeChart

I have a problem using IGraphics3D in a tChart. I can draw any type of picture over the tChart, but when I try to export the image using getImage() to a file the drawings disappear. These pictures also disappears when I click with the mouse over the Chart. I'm using the "com.steema.teechart.tools.Annotation" also and that it works how I want. However I don't know why the Graphics3D have a different behaviour.

I copy the code that shows how I create the drawings:

IGraphics3D grafics = tChart.getGraphics3D();
grafics.getPen().setColor(liniaGrafica.getColorLinia());
Series serie = tChart.getSeries(liniaGrafica.getIndexSerie());
grafics.line(X1, Y, X2, Y);

Can anyone help me with that doubt.

Thank you in advance.

Upvotes: 1

Views: 270

Answers (1)

Yeray
Yeray

Reputation: 5039

Note you have to call the custom drawing routines at the chartPainted event. Here you have an example:

private static void initializeChart() {
    tChart1.getAspect().setView3D(false);
    Area area1 = new Area(tChart1.getChart());
    area1.fillSampleValues(100);

    tChart1.addChartPaintListener(new ChartPaintAdapter() {
        @Override
        public void chartPainted(ChartDrawEvent e) {
            IGraphics3D grafics = tChart1.getGraphics3D();
            grafics.getPen().setColor(tChart1.getSeries(0).getColor());
            grafics.line(0, 0, 100, 100);
        }
    });  
}

Upvotes: 1

Related Questions