Chart Background

Overview

Among all other settings, AnyChart Stock has two special elements:

The illustration below gives an explanation to these elements:

to top

General Background

General background surrounds all the elements displayable by the component: charts, labels and all others. As any other element configurable in the <background> node, it supports the customization of the filler, border, corners and paddings.

Here is a sample XML that demonstrates customizing the general background:

XML/JSON Syntax
Plain code
01 <?xml version="1.0" encoding="UTF-8"?>
02 <stock xmlns="http://anychart.com/products/stock/schemas/1.9.0/schema.xsd">
03   <settings>
04     <background enabled="true">
05       <fill enabled="true" type="Gradient">
06         <gradient angle="90">
07           <keys>
08             <key color="#FFFFFF" />
09             <key color="#EEEEEE" />
10             <key color="#FFFFFF" />
11           </keys>
12         </gradient>
13       </fill>
14       <border enabled="true" color="#2466B1" thickness="2" />
15       <corners type="Rounded" all="10" />
16     </background>
17   </settings>
18 </stock>
01{
02  settings: {
03    background: {
04      enabled: true,
05      fill: {
06        enabled: true,
07        type: "Gradient",
08        gradient: {
09          angle: 90,
10          keys: [
11            {
12              color: "#FFFFFF"
13            },
14            {
15              color: "#EEEEEE"
16            },
17            {
18              color: "#FFFFFF"
19            }
20          ]
21        }
22      },
23      border: {
24        enabled: true,
25        color: "#2466B1",
26        thickness: 2
27      },
28      corners: {
29        type: "Rounded",
30        all: 10
31      }
32    }
33  }
34}

This live sample shows the configured background in action:

Live Sample:  Chart General Background Configuration

Find out more about background configuration options in Background Settings and XML Reference.

to top

Chart Background

Each chart can have its own background, but only with a filler and border. Here is a sample XML that shows how to customize background for a specific chart:

XML/JSON Syntax
Plain code
01 <chart>
02   <background enabled="true">
03     <fill enabled="true" type="Gradient" opacity="1">
04       <gradient angle="90">
05         <keys>
06           <key color="#EEEEEE" />
07           <key color="White" />
08         </keys>
09       </gradient>
10     </fill>
11     <border color="#7777BB" />
12   </background>
13 </chart>
01{
02  background: {
03    enabled: true,
04    fill: {
05      enabled: true,
06      type: "Gradient",
07      opacity: 1,
08      gradient: {
09        angle: 90,
10        keys: [
11          {
12            color: "#EEEEEE"
13          },
14          {
15            color: "White"
16          }
17        ]
18      }
19    },
20    border: {
21      color: "#7777BB"
22    }
23  }
24}

This live sample demonstrates a chart with an individually customized background:

Live Sample:  Individual Chart Background Settings

Find out more about background configuration options in Background Settings and XML Reference.

to top