HTMLcopy
1
<div id="container"></div>
CSScopy
6
1
html, body, #container {
2
width: 100%;
3
height: 100%;
4
margin: 0;
5
padding: 0;
6
}
JavaScriptcopy
x
1
anychart.onDocumentReady(function() {
2
3
var color1 = "#FF0000";
4
5
// Variable for controlling color enlightenment
6
var colorIndex = 0;
7
8
// color lightning function
9
function colorizer(){
10
var mixColor1 = anychart.color.lighten(color1, colorIndex);
11
colorIndex = colorIndex + 0.2;
12
return mixColor1;
13
}
14
15
// data and fill color settings
16
var data = anychart.data.set([
17
{x: "P1", value: 10000, fill: (colorizer())},
18
{x: "P2", value: 12000, fill: (colorizer())},
19
{x: "P3", value: 18000, fill: (colorizer())},
20
{x: "P4", value: 13000, fill: (colorizer())},
21
{x: "P5", value: 9000, fill: (colorizer())}
22
]);
23
24
// chart type
25
var chart = anychart.column();
26
27
chart.title("Lighten Colors Sample");
28
29
// set data and set additional information in tooltip
30
var series = chart.column(data);
31
series.stroke(null);
32
var tooltip = series.tooltip();
33
tooltip.format(function(){
34
var mixColor2 = anychart.color.lighten(color1, (this.index * 0.2));
35
return "Input Color: " + color1 +
36
"\nLighten Ratio: " + this.index * 2 / 10 +
37
"\nResult: " + mixColor2;
38
});
39
40
// draw
41
chart.container("container");
42
chart.draw();
43
});