Convert Chart to Image for Java

Last post 02-11-2010, 6:10 AM by Amjad Sahi. 27 replies.
Page 1 of 2 (28 items)   1 2 Next >
Sort Posts: Previous Next
  •  09-16-2009, 8:49 PM 198204

    Convert Chart to Image for Java

    Hello,

        Will the conversion of a chart to image for Java be included in your Q4 release? When will it be released?

    thanks

    This message was posted using Page2Forum from Converting Chart to Image - Aspose.Cells for .NET
     
  •  09-16-2009, 9:09 PM 198206 in reply to 198204

    Re: Convert Chart to Image for Java

    I plan to release this feature in 2010 Q1.  We can send you a beta version in 2009/11 or 2009/12 if you'd like to be our beta user.


    Laurence Chen
    Chief Architect
    Aspose Nanjing Team
    About Us
    Contact Us
     
  •  09-26-2009, 12:54 PM 199778 in reply to 198206

    Re: Convert Chart to Image for Java

    That would be great Laurence! :)

    cheers
     
  •  10-13-2009, 6:58 PM 202304 in reply to 198206

    Re: Convert Chart to Image for Java

    Laurence,
    We have been waiting for this feature for some time, glad to hear that it is finally being implemented! We would love to be beta testers for the chart to image functionality, could you please include us as well?

    -Chad
     
  •  11-18-2009, 7:48 AM 208636 in reply to 202304

    Re: Convert Chart to Image for Java

    Just a thread bump to see what the updated timeline is for a beta release for this feature. Thanks!

    -Chad
     
  •  11-19-2009, 1:34 AM 208772 in reply to 208636

    Re: Convert Chart to Image for Java

    Hi,

     

    Thank you for considering Aspose.

     

    We are planning to release the beta version for Chart2Image feature in Aspose.Cells for Java in the next week. We will update you in the thread when a beta version will be released.

     

    Thank You & Best Regards,


    Nausherwan Aslam
    Support Developer,
    Aspose Sialkot Team
    Contact Us
     
  •  11-30-2009, 4:28 PM 210345 in reply to 208772

    Re: Convert Chart to Image for Java

    Hey - Wanted to see if you guys realeased the beta update? Can you post a link to the beta download when you get a chance. I think a lot of folks have been waiting for this update ;)

    Thanks.
     
  •  12-01-2009, 3:01 AM 210404 in reply to 210345

    Re: Convert Chart to Image for Java

    We are testing and fixing some issues in chart2image feature. Johnson will provide you a beta version here soon.
    Laurence Chen
    Chief Architect
    Aspose Nanjing Team
    About Us
    Contact Us
     
  •  12-01-2009, 5:15 AM 210428 in reply to 210345

    Re: Convert Chart to Image for Java

    Attachment: Present (inaccessible)

    Hi,

    Please try this beta version for Chart2Image feature. Currently the supported properties are:

    1. ChartType:
        AREA, AREA_STACKED, AREA_100PERCENT_STACKED,
        BAR_CLUSTERED, BAR_STACKED, BAR_100PERCENT_STACKED,
        BUBBLE,
        COLUMN_CLUSTERED, COLUMN_STACKED, COLUMN_100PERCENT_STACKED,
        DOUGHNUT,
        LINE, LINE_STACKED, LINE_100PERCENT_STACKED,
        PIE,
        SCATTER, SCATTER_CONNECTED_BY_LINES_WITH_DATA_MARKE, SCATTER_CONNECTED_BY_LINES_WITHOUT_DATA_MARKE,

    2. Generated Image file format:
       PNG, JPEG

    3. Properties of Chart: Axis, Title, Legend, DataLabels

    The API is:

    void com.aspose.cells.Chart.toImage(String file, ImageOptions options)

         Converts this chart to image.

         Parameters:
    file the image file to be generated.
    options settings for generating image. If null will use default options, generated image file format is PNG.

    Thank you.


    Johnson Shi
    Developer
    Aspose Nanjing Team
    About Us
    Contact Us
     
  •  12-01-2009, 2:27 PM 210551 in reply to 210428

    Re: Convert Chart to Image for Java

    Aspose Team,

    I was directed to this forum post through another post about this beta feature. It's nice to see it finally being implemented - thank you. I was wondering if it is possible to get the toImage() method implemented with an OutputStream too. I have a case where I don't want to write to a file but to a stream. I'd hate to have to create a temporary file just to get it into a stream.

    Thanks,
    Frank
     
  •  12-01-2009, 8:01 PM 210589 in reply to 210551

    Re: Convert Chart to Image for Java

    Hi Frank,

    We will add an overloaded toImage() method for you soon to write images to a stream. Thank you.


    Johnson Shi
    Developer
    Aspose Nanjing Team
    About Us
    Contact Us
     
  •  12-02-2009, 11:27 AM 210780 in reply to 210589

    Re: Convert Chart to Image for Java

    The following code is throwing these errors. Any ideas what I'm doing wrong? The workbook saves properly with the correct charts, but I can't turn the charts into images.

    Thanks,
    Frank

    java.lang.NullPointerException
        at com.aspose.cells.ASeries.getType(Unknown Source)
        at com.aspose.a.c.a.a(Unknown Source)
        at com.aspose.cells.Chart.toImage(Unknown Source)
        at com.test.ChartImage.main(ChartImage.java:44)
    java.lang.NullPointerException
        at com.aspose.cells.ASeries.getType(Unknown Source)
        at com.aspose.a.c.a.a(Unknown Source)
        at com.aspose.cells.Chart.toImage(Unknown Source)
        at com.test.ChartImage.main(ChartImage.java:51)

    package com.test;

    import com.aspose.cells.CategoryAxis;
    import com.aspose.cells.Cells;
    import com.aspose.cells.CellsHelper;
    import com.aspose.cells.Chart;
    import com.aspose.cells.ChartType;
    import com.aspose.cells.Color;
    import com.aspose.cells.Font;
    import com.aspose.cells.ImageFormat;
    import com.aspose.cells.ImageOptions;
    import com.aspose.cells.Legend;
    import com.aspose.cells.LegendPositionType;
    import com.aspose.cells.NSeries;
    import com.aspose.cells.TickMarkerType;
    import com.aspose.cells.ValueAxis;
    import com.aspose.cells.Workbook;
    import com.aspose.cells.Worksheet;

    public class ChartImage {

      private static Chart chart;
      private static String dir =  "c:\\temp\\";

      public static void main( String[] arguments) throws Exception
      {
        final Workbook wb = new Workbook();
        final Worksheet ws = wb.getWorksheets().getActiveSheet();
        final Cells c = ws.getCells();

        for (int i=1, value=1; i<4; i++)
        {
          c.getCell("A" + i).setValue("R" + i);
          for (int j=1; j<5; j++, value++)
            c.getCell(CellsHelper.convertColumnIndexToName(j) + i).setValue(value);
        }

        final Worksheet worksheet = wb.getWorksheets().getActiveSheet();
        chart = worksheet.getCharts().addChart(ChartType.COLUMN_CLUSTERED, 5, 1, 18, 4);
        drawReportViewerBarChart();
        final ImageOptions imgOpts = new ImageOptions();
        imgOpts.setImageFormat(ImageFormat.PNG);
        try {
          chart.toImage(dir + "chart1.png", imgOpts);
        } catch (Exception e) {
          e.printStackTrace();
        }
        chart = worksheet.getCharts().addChart(ChartType.PIE, 5, 6, 18, 9);
        drawReportViewerPieChart();
        try {
          chart.toImage(dir + "chart2.png", imgOpts);
        } catch (Exception e) {
          e.printStackTrace();
        }
        wb.save(dir + "chart.xls");
      }

      private static void drawReportViewerPieChart() throws Exception
      {
        chart.setType(ChartType.PIE);
        chart.getNSeries().add("Sheet1!$A$1:$E$3", true);
        chart.getPlotArea().getArea().setVisible(false);
        drawReportViewerChart();
      }

      private static void drawReportViewerBarChart() throws Exception
      {
        chart.setType(ChartType.COLUMN_CLUSTERED);
        chart.getNSeries().add("Sheet1!$A$1:$E$3", true);
        chart.getPlotArea().getArea().setForegroundColor(Color.GRAY);
        drawReportViewerChart();
      }

      private static void drawReportViewerChart() throws Exception
      {
        chart.getTitle().getFont().setBold(true);
        chart.getTitle().getFont().setSize(10);
        chart.getPlotArea().getBorder().setVisible(false);

        NSeries nSeries = chart.getNSeries();
        final int size = nSeries.size();
        for (int i = 0; i < size; )
          chart.getNSeries().get(i).setName("C" + ++i);

        Legend legend = chart.getLegend();
        legend.getFont().setSize(8);
        legend.getBorder().setVisible(false);
        legend.setPosition(LegendPositionType.BOTTOM);
        chart.setLegendShown(true);

        CategoryAxis ca = chart.getCategoryAxis();
        Font f = ca.getTitle().getFont();
        f.setSize(10);
        f.setBold(true);
        ca.getFont().setBold(false);
        ca.getFont().setSize(8);
        ca.setMajorTickMark(TickMarkerType.OUTSIDE);

        ValueAxis va = chart.getValueAxis();
        va.getFont().setBold(false);
        va.getFont().setSize(8);
        va.setMajorTickMark(TickMarkerType.OUTSIDE);
      }
    }
     
  •  12-02-2009, 12:17 PM 210788 in reply to 210780

    Re: Convert Chart to Image for Java

    Hi,

    We found the issue as you have mentioned. We will figure it out soon.

    Your issue has been logged into our issue tracking system with an issue id: CELLSJAVA-12243.

    Thank you.

    Amjad Sahi
    Support Developer,
    Aspose Sialkot Team
    Contact Us
     
  •  12-02-2009, 6:47 PM 210857 in reply to 210780

    Re: Convert Chart to Image for Java

    Hi,

     Thank you for considering Aspose.

     We will add a toImage() method and fix the bug as soon as possible.

     
  •  12-03-2009, 6:59 AM 210972 in reply to 210788

    Re: Convert Chart to Image for Java

    Attachment: Present (inaccessible)

    Hi,

    Please try this fix. We have fixed the issue of NullPointerException. Also we add added an overloaded method for Chart.toImage:

    void com.aspose.cells.Chart.toImage(OutputStream stream, ImageOptions options)

         Converts this chart to image.

         Parameters:
    stream the stream to save generated image.
    options settings for generating image.

    And for the ImageOptions parameter, now it is not allowed to be null for both toImage methods.

    Thank you.


    Johnson Shi
    Developer
    Aspose Nanjing Team
    About Us
    Contact Us
     
Page 1 of 2 (28 items)   1 2 Next >
View as RSS news feed in XML