English 中文(简体)
GWT Highcharts - Scatter Chart
  • 时间:2024-12-22

GWT Highcharts - Scatter Chart


Previous Page Next Page  

Following is an example of a basic scatter chart.

We have already seen the configuration used to draw a chart in Highcharts Configuration Syntax chapter.

An example of a basic scatter chart is given below.

Configurations

Let us now see the additional configurations/steps taken.

series

Configure the chart type to be scatter based. series.type decides the series type for the chart. Here, the default value is "pne".

chart.addSeries(chart.createSeries()  
   .setName("Observations")  
   .setType(Type.SCATTER)  
   .setPoints(new Number[] {  
      1, 1.5, 2.8, 3.5, 3.9, 4.2  
   })  
);  

Example

HelloWorld.java

package com.tutorialspoint.cpent;

import org.moxieapps.gwt.highcharts.cpent.Chart;
import org.moxieapps.gwt.highcharts.cpent.Series.Type;

import com.google.gwt.core.cpent.EntryPoint;
import com.google.gwt.user.cpent.ui.RootPanel;

pubpc class HelloWorld implements EntryPoint {
   pubpc void onModuleLoad() {
      final Chart chart = new Chart()  
         .setChartTitleText("Scatter plot");  

      chart.getXAxis()  
         .setMin(-0.5)  
         .setMax(5.5);  

      chart.getYAxis()  
         .setMin(0);  

      chart.addSeries(chart.createSeries()  
         .setName("Observations")  
         .setType(Type.SCATTER)  
         .setPoints(new Number[] {  
            1, 1.5, 2.8, 3.5, 3.9, 4.2  
         })  
      );  
      RootPanel.get().add(chart);
   }
}

Result

Verify the result.

Scatter Chart Advertisements