| layout | post |
|---|---|
| title | Scatter in |
| description | Learn here all about Scatter in Syncfusion |
| platform | ej2-javascript |
| control | Scatter |
| publishingplatform | |
| documentation | ug |
| domainurl |
To render a scatter series in your chart, you need to follow a few steps to configure it correctly. Here's a concise guide on how to do this:
- Set the series type: Define the series
typeasScatterin your chart configuration. This indicates that the data should be displayed as individual points scattered across the chart.
{% if page.publishingplatform == "typescript" %}
- Inject the ScatterSeries module: Use the
Chart.Inject(ScatterSeries)method to inject theScatterSeriesmodule into your chart. This step is essential, as it ensures that the necessary functionalities for rendering the scatter series are available in your chart.
{% tabs %} {% highlight ts tabtitle="index.ts" %} {% include code-snippet/chart/chart-types-cs127/index.ts %} {% endhighlight %} {% highlight html tabtitle="index.html" %} {% include code-snippet/chart/chart-types-cs127/index.html %} {% endhighlight %} {% endtabs %}
{% previewsample "page.domainurl/code-snippet/chart/chart-types-cs127" %}
{% elsif page.publishingplatform == "javascript" %}
{% tabs %} {% highlight js tabtitle="index.js" %} {% include code-snippet/chart/chart-types-cs127/index.js %} {% endhighlight %} {% highlight html tabtitle="index.html" %} {% include code-snippet/chart/chart-types-cs127/index.html %} {% endhighlight %} {% endtabs %}
{% previewsample "page.domainurl/code-snippet/chart/chart-types-cs127" %} {% endif %}
You can bind data to the chart using the dataSource property within the series configuration. This allows you to connect a JSON dataset or remote data to your chart. To display the data correctly, map the fields from the data to the chart series xName and yName properties.
{% if page.publishingplatform == "typescript" %}
{% tabs %} {% highlight ts tabtitle="index.ts" %} {% include code-snippet/chart/chart-types-cs349/index.ts %} {% endhighlight %} {% highlight html tabtitle="index.html" %} {% include code-snippet/chart/chart-types-cs349/index.html %} {% endhighlight %} {% endtabs %}
{% previewsample "page.domainurl/code-snippet/chart/chart-types-cs349" %}
{% elsif page.publishingplatform == "javascript" %}
{% tabs %} {% highlight js tabtitle="index.js" %} {% include code-snippet/chart/chart-types-cs349/index.js %} {% endhighlight %} {% highlight html tabtitle="index.html" %} {% include code-snippet/chart/chart-types-cs349/index.html %} {% endhighlight %} {% endtabs %}
{% previewsample "page.domainurl/code-snippet/chart/chart-types-cs349" %} {% endif %}
The following properties can be used to customize the scatter series.
Fill
The fill property determines the color applied to the series.
{% if page.publishingplatform == "typescript" %}
{% tabs %} {% highlight ts tabtitle="index.ts" %} {% include code-snippet/chart/chart-types-cs128/index.ts %} {% endhighlight %} {% highlight html tabtitle="index.html" %} {% include code-snippet/chart/chart-types-cs128/index.html %} {% endhighlight %} {% endtabs %}
{% previewsample "page.domainurl/code-snippet/chart/chart-types-cs128" %}
{% elsif page.publishingplatform == "javascript" %}
{% tabs %} {% highlight js tabtitle="index.js" %} {% include code-snippet/chart/chart-types-cs128/index.js %} {% endhighlight %} {% highlight html tabtitle="index.html" %} {% include code-snippet/chart/chart-types-cs128/index.html %} {% endhighlight %} {% endtabs %}
{% previewsample "page.domainurl/code-snippet/chart/chart-types-cs128" %} {% endif %}
Opacity
The opacity property specifies the transparency level of the fill. Adjusting this property allows you to control how opaque or transparent the fill color of the series appears.
{% if page.publishingplatform == "typescript" %}
{% tabs %} {% highlight ts tabtitle="index.ts" %} {% include code-snippet/chart/chart-types-cs350/index.ts %} {% endhighlight %} {% highlight html tabtitle="index.html" %} {% include code-snippet/chart/chart-types-cs350/index.html %} {% endhighlight %} {% endtabs %}
{% previewsample "page.domainurl/code-snippet/chart/chart-types-cs350" %}
{% elsif page.publishingplatform == "javascript" %}
{% tabs %} {% highlight js tabtitle="index.js" %} {% include code-snippet/chart/chart-types-cs350/index.js %} {% endhighlight %} {% highlight html tabtitle="index.html" %} {% include code-snippet/chart/chart-types-cs350/index.html %} {% endhighlight %} {% endtabs %}
{% previewsample "page.domainurl/code-snippet/chart/chart-types-cs350" %} {% endif %}
Shape
The shape property allows you to customize the appearance of the markers by specifying different shapes.
{% if page.publishingplatform == "typescript" %}
{% tabs %} {% highlight ts tabtitle="index.ts" %} {% include code-snippet/chart/chart-types-cs351/index.ts %} {% endhighlight %} {% highlight html tabtitle="index.html" %} {% include code-snippet/chart/chart-types-cs351/index.html %} {% endhighlight %} {% endtabs %}
{% previewsample "page.domainurl/code-snippet/chart/chart-types-cs351" %}
{% elsif page.publishingplatform == "javascript" %}
{% tabs %} {% highlight js tabtitle="index.js" %} {% include code-snippet/chart/chart-types-cs351/index.js %} {% endhighlight %} {% highlight html tabtitle="index.html" %} {% include code-snippet/chart/chart-types-cs351/index.html %} {% endhighlight %} {% endtabs %}
{% previewsample "page.domainurl/code-snippet/chart/chart-types-cs351" %} {% endif %}
Border
The border property allows you to customize the border of the series by defining its color, width, and dashArray.
{% if page.publishingplatform == "typescript" %}
{% tabs %} {% highlight ts tabtitle="index.ts" %} {% include code-snippet/chart/chart-types-cs488/index.ts %} {% endhighlight %} {% highlight html tabtitle="index.html" %} {% include code-snippet/chart/chart-types-cs488/index.html %} {% endhighlight %} {% endtabs %}
{% previewsample "page.domainurl/code-snippet/chart/chart-types-cs488" %}
{% elsif page.publishingplatform == "javascript" %}
{% tabs %} {% highlight js tabtitle="index.js" %} {% include code-snippet/chart/chart-types-cs488/index.js %} {% endhighlight %} {% highlight html tabtitle="index.html" %} {% include code-snippet/chart/chart-types-cs488/index.html %} {% endhighlight %} {% endtabs %}
{% previewsample "page.domainurl/code-snippet/chart/chart-types-cs488" %} {% endif %}
Data points with null or undefined values are considered empty. Empty data points are ignored and not plotted on the chart.
Mode
Use the mode property to define how empty or missing data points are handled in the series. The default mode for empty points is Gap.
{% if page.publishingplatform == "typescript" %}
{% tabs %} {% highlight ts tabtitle="index.ts" %} {% include code-snippet/chart/chart-types-cs352/index.ts %} {% endhighlight %} {% highlight html tabtitle="index.html" %} {% include code-snippet/chart/chart-types-cs352/index.html %} {% endhighlight %} {% highlight ts tabtitle="datasource.ts" %} {% include code-snippet/chart/chart-types-cs352/datasource.ts %} {% endhighlight %} {% endtabs %}
{% previewsample "page.domainurl/code-snippet/chart/chart-types-cs352" %}
{% elsif page.publishingplatform == "javascript" %}
{% tabs %} {% highlight js tabtitle="index.js" %} {% include code-snippet/chart/chart-types-cs352/index.js %} {% endhighlight %} {% highlight html tabtitle="index.html" %} {% include code-snippet/chart/chart-types-cs352/index.html %} {% endhighlight %} {% endtabs %}
{% previewsample "page.domainurl/code-snippet/chart/chart-types-cs352" %} {% endif %}
Fill
Use the fill property to customize the fill color of empty points in the series.
{% if page.publishingplatform == "typescript" %}
{% tabs %} {% highlight ts tabtitle="index.ts" %} {% include code-snippet/chart/chart-types-cs353/index.ts %} {% endhighlight %} {% highlight html tabtitle="index.html" %} {% include code-snippet/chart/chart-types-cs353/index.html %} {% endhighlight %} {% highlight ts tabtitle="datasource.ts" %} {% include code-snippet/chart/chart-types-cs353/datasource.ts %} {% endhighlight %} {% endtabs %}
{% previewsample "page.domainurl/code-snippet/chart/chart-types-cs353" %}
{% elsif page.publishingplatform == "javascript" %}
{% tabs %} {% highlight js tabtitle="index.js" %} {% include code-snippet/chart/chart-types-cs353/index.js %} {% endhighlight %} {% highlight html tabtitle="index.html" %} {% include code-snippet/chart/chart-types-cs353/index.html %} {% endhighlight %} {% endtabs %}
{% previewsample "page.domainurl/code-snippet/chart/chart-types-cs353" %} {% endif %}
Border
Use the border property to customize the width and color of the border for empty points.
{% if page.publishingplatform == "typescript" %}
{% tabs %} {% highlight ts tabtitle="index.ts" %} {% include code-snippet/chart/chart-types-cs354/index.ts %} {% endhighlight %} {% highlight html tabtitle="index.html" %} {% include code-snippet/chart/chart-types-cs354/index.html %} {% endhighlight %} {% highlight ts tabtitle="datasource.ts" %} {% include code-snippet/chart/chart-types-cs354/datasource.ts %} {% endhighlight %} {% endtabs %}
{% previewsample "page.domainurl/code-snippet/chart/chart-types-cs354" %}
{% elsif page.publishingplatform == "javascript" %}
{% tabs %} {% highlight js tabtitle="index.js" %} {% include code-snippet/chart/chart-types-cs354/index.js %} {% endhighlight %} {% highlight html tabtitle="index.html" %} {% include code-snippet/chart/chart-types-cs354/index.html %} {% endhighlight %} {% endtabs %}
{% previewsample "page.domainurl/code-snippet/chart/chart-types-cs354" %} {% endif %}
The seriesRender event allows you to customize series properties, such as data, fill, and name, before they are rendered on the chart.
{% if page.publishingplatform == "typescript" %}
{% tabs %} {% highlight ts tabtitle="index.ts" %} {% include code-snippet/chart/chart-types-cs441/index.ts %} {% endhighlight %} {% highlight html tabtitle="index.html" %} {% include code-snippet/chart/chart-types-cs441/index.html %} {% endhighlight %} {% highlight ts tabtitle="datasource.ts" %} {% include code-snippet/chart/chart-types-cs441/datasource.ts %} {% endhighlight %} {% endtabs %}
{% previewsample "page.domainurl/code-snippet/chart/chart-types-cs441" %}
{% elsif page.publishingplatform == "javascript" %}
{% tabs %} {% highlight js tabtitle="index.js" %} {% include code-snippet/chart/chart-types-cs441/index.js %} {% endhighlight %} {% highlight html tabtitle="index.html" %} {% include code-snippet/chart/chart-types-cs441/index.html %} {% endhighlight %} {% endtabs %}
{% previewsample "page.domainurl/code-snippet/chart/chart-types-cs441" %} {% endif %}
The pointRender event allows you to customize each data point before it is rendered on the chart.
{% if page.publishingplatform == "typescript" %}
{% tabs %} {% highlight ts tabtitle="index.ts" %} {% include code-snippet/chart/chart-types-cs442/index.ts %} {% endhighlight %} {% highlight html tabtitle="index.html" %} {% include code-snippet/chart/chart-types-cs442/index.html %} {% endhighlight %} {% highlight ts tabtitle="datasource.ts" %} {% include code-snippet/chart/chart-types-cs442/datasource.ts %} {% endhighlight %} {% endtabs %}
{% previewsample "page.domainurl/code-snippet/chart/chart-types-cs442" %}
{% elsif page.publishingplatform == "javascript" %}
{% tabs %} {% highlight js tabtitle="index.js" %} {% include code-snippet/chart/chart-types-cs442/index.js %} {% endhighlight %} {% highlight html tabtitle="index.html" %} {% include code-snippet/chart/chart-types-cs442/index.html %} {% endhighlight %} {% endtabs %}
{% previewsample "page.domainurl/code-snippet/chart/chart-types-cs442" %} {% endif %}