1. Products
  2.   3D
  3.   Java
  4.   Orson Charts
 
  

Open Source Java Library to Create & Manage 3D Charts

Generate, Edit and Mange a Wide Variety of 3D Charts That Can be Easily Used in client-side as well as Server-side Applications using Free Java 3D API.

Orson Charts is a very powerful open source library that enables your Java application to create as well as manage a wide variety of 3D charts with ease. The created 3D charts can be used in client-side applications as well as server-side applications. It can also be exported to several important file formats such as PDF, SVG, PNG, JPEG, and many more.

The Orson Charts library has provided ease-of-use for users and enables software developers to produce stunning interactive multiple chart types, such as pie charts, bar charts, line charts, area charts, scatter plots, surface charts, etc. There are several important features included related to chart manipulation such as creating charts, modifying charts, viewing charts, chart data rendering, interactive charts support, and many more.

The Orson Charts is a consistent and well-documented library that included mouse-enabled chart viewers. It has also included configurable tooltip support. It also supports a mouse-enabled chart viewer that provides 360-degree rotation as well as zooming.The API leverages advanced rendering techniques to produce high-quality, visually appealing charts. Anti-aliasing, lighting effects, and texture mapping contribute to the realism and clarity of the rendered 3D graphics. Whether developers need building enterprise software, scientific applications, or educational tools, Orson Charts provides the tools necessary to bring your data to life in three dimensions.

Previous Next

Getting Started with Orson Charts

The easiest and recommended way to install Orson Charts is via GitHub. Please use the following command to install Orson Charts.

Install Orson Charts via GitHub

gh repo clone jfree/orson-charts

Create Multiple Charts via Java

The open source library Orson Charts has provided functionality for creating multiple types of charts inside their own applications. The library provides some useful methods to construct common types of charts such as Area chart, Bar chart, Line Chart, stacked bar chart, pie chart, and so on. You can provide a title for the charts. Charts can have simple titles or composite titles. You can easily modify an existing chart element, title, and set the range of your own choice.

How to Create a Simple 3D Bar Chart using Java API?

import com.orsoncharts.Chart3DFactory;
import com.orsoncharts.Chart3DPanel;
import com.orsoncharts.Chart3D;

public class OrsonChartsExample {

    public static void main(String[] args) {
        // Create a new 3D bar chart
        Chart3D chart = Chart3DFactory.createBarChart("Sample Data", "Category", "Value", null, dataset);

        // Create a chart panel to display the chart
        Chart3DPanel chartPanel = new Chart3DPanel(chart);

        // Display the chart panel within a Swing application window
        JFrame frame = new JFrame("Orson Charts Example");
        frame.getContentPane().add(chartPanel);
        frame.setSize(800, 600);
        frame.setVisible(true);
    }
}

Exporting Charts to PDF via Java

The Orson Charts library enables software developers to export charts to PDF file format with just a couple of lines of Java code. Once you have composed the elements of the chart, set the title, range of data values, and things are finalized, you can render it to a PDF file with ease. Moreover, the chart viewer component allows developers to zoom and rotate charts at 360 degrees in any direction.

How to Export the Chart to PDF using Java API?

import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.pdmodel.PDPageContentStream;
import org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject;

// Create a blank PDF document
PDDocument document = new PDDocument();
PDPage page = new PDPage();
document.addPage(page);

// Create a content stream for the page
PDPageContentStream contentStream = new PDPageContentStream(document, page);

// Export the chart to an image (PNG, JPEG, etc.)
// Assuming chartPanel is your Chart3DPanel instance
BufferedImage image = chartPanel.getChart().createBufferedImage(800, 600); // Adjust width and height as needed

// Convert the BufferedImage to a PDImageXObject
PDImageXObject pdImage = PDImageXObject.createFromByteArray(document, bufferedImageToByteArray(image), "chart");

// Draw the chart image on the PDF page
contentStream.drawImage(pdImage, 100, 100); // Adjust position as needed

// Close the content stream
contentStream.close();

// Save the PDF document to a file
document.save("chart.pdf");

// Close the PDF document
document.close();

Render Charts to SVG Formats

The SVG (Scalable Vector Graphics) specification is an open standard developed by the World Wide Web Consortium (W3C) since 1999. SVG is used to define vector-based graphics for the Web. The great thing is that every element and every attribute in SVG files can be animated. The Orson Charts library enables software developers to c export chart to SVG, PNG, and JPEG formats with just a couple of lines of code.

How to Render Charts to SVG using Java API?

import com.orsoncharts.Chart3D;
import com.orsoncharts.Chart3DFactory;

// Create a 3D bar chart (Example)
Chart3D chart = Chart3DFactory.createBarChart("Sample Data", "Category", "Value", dataset);

// Customize chart settings (Example)
chart.setTitle("Sales Data");
chart.setChartBoxColor(Color.WHITE);
// Add more customization as needed

// Create SVG exporter
ChartExporter exporter = new SVGExporter();

// Render chart to SVG
exporter.export(chart, "path/to/output.svg", 800, 600);

 English