Customizing Points

Overview

In many Google Charts, data values are displayed at precise points. A line chart is just a set of these points connected by lines, and a scatter chart is nothing but points.

In all charts but the scatter chart, these points are zero-sized by default. You can control their size with the pointSize option, and their shape with the pointShape option.

Above, you can see a chart with six series, each with pointSize 30 but a different pointShape .

Options
  
 var 
  
 options 
  
 = 
  
 { 
  
 legend 
 : 
  
 'none' 
 , 
  
 hAxis 
 : 
  
 { 
  
 minValue 
 : 
  
 0 
 , 
  
 maxValue 
 : 
  
 7 
  
 }, 
  
  pointSize 
 : 
  
 30 
 , 
  
 series 
 : 
  
 { 
  
 0 
 : 
  
 { 
  
 pointShape 
 : 
  
 'circle' 
  
 }, 
  
 1 
 : 
  
 { 
  
 pointShape 
 : 
  
 'triangle' 
  
 }, 
  
 2 
 : 
  
 { 
  
 pointShape 
 : 
  
 'square' 
  
 }, 
  
 3 
 : 
  
 { 
  
 pointShape 
 : 
  
 'diamond' 
  
 }, 
  
 4 
 : 
  
 { 
  
 pointShape 
 : 
  
 'star' 
  
 }, 
  
 5 
 : 
  
 { 
  
 pointShape 
 : 
  
 'polygon' 
  
 } 
  
 } 
 
  
 }; 
Full HTML
  
< head 
>  
< script 
  
 type 
 = 
 "text/javascript" 
  
 src 
 = 
 "https://www.gstatic.com/charts/loader.js" 
>< / 
 script 
>  
< script 
  
 type 
 = 
 "text/javascript" 
>  
 google 
 . 
 charts 
 . 
 load 
 ( 
 "current" 
 , 
  
 { 
 packages 
 :[ 
 "corechart" 
 ]}); 
  
 google 
 . 
 charts 
 . 
 setOnLoadCallback 
 ( 
 drawChart 
 ); 
  
 function 
  
 drawChart 
 () 
  
 { 
  
 var 
  
 data 
  
 = 
  
 google 
 . 
 visualization 
 . 
 arrayToDataTable 
  
 ([[ 
 'X' 
 , 
  
 '1' 
 , 
  
 '2' 
 , 
  
 '3' 
 , 
  
 '4' 
 , 
  
 '5' 
 , 
  
 '6' 
 ], 
  
 [ 
 1 
 , 
  
 2 
 , 
  
 null 
 , 
  
 null 
 , 
  
 null 
 , 
  
 null 
 , 
  
 null 
 ], 
  
 [ 
 2 
 , 
  
 null 
 , 
  
 3 
 , 
  
 null 
 , 
  
 null 
 , 
  
 null 
 , 
  
 null 
 ], 
  
 [ 
 3 
 , 
  
 null 
 , 
  
 null 
 , 
  
 4 
 , 
  
 null 
 , 
  
 null 
 , 
  
 null 
 ], 
  
 [ 
 4 
 , 
  
 null 
 , 
  
 null 
 , 
  
 null 
 , 
  
 5 
 , 
  
 null 
 , 
  
 null 
 ], 
  
 [ 
 5 
 , 
  
 null 
 , 
  
 null 
 , 
  
 null 
 , 
  
 null 
 , 
  
 6 
 , 
  
 null 
 ], 
  
 [ 
 6 
 , 
  
 null 
 , 
  
 null 
 , 
  
 null 
 , 
  
 null 
 , 
  
 null 
 , 
  
 7 
 ] 
  
 ]); 
  
 var 
  
 options 
  
 = 
  
 { 
  
 legend 
 : 
  
 'none' 
 , 
  
  pointSize 
 : 
  
 30 
 , 
  
 series 
 : 
  
 { 
  
 0 
 : 
  
 { 
  
 pointShape 
 : 
  
 'circle' 
  
 }, 
  
 1 
 : 
  
 { 
  
 pointShape 
 : 
  
 'triangle' 
  
 }, 
  
 2 
 : 
  
 { 
  
 pointShape 
 : 
  
 'square' 
  
 }, 
  
 3 
 : 
  
 { 
  
 pointShape 
 : 
  
 'diamond' 
  
 }, 
  
 4 
 : 
  
 { 
  
 pointShape 
 : 
  
 'star' 
  
 }, 
  
 5 
 : 
  
 { 
  
 pointShape 
 : 
  
 'polygon' 
  
 } 
  
 } 
 
  
 }; 
  
 var 
  
 chart 
  
 = 
  
 new 
  
 google 
 . 
 visualization 
 . 
 LineChart 
 ( 
 document 
 . 
 getElementById 
 ( 
 'chart_div' 
 )); 
  
 chart 
 . 
 draw 
 ( 
 data 
 , 
  
 options 
 ); 
  
 } 
  
< / 
 script 
>  
< / 
 head 
>  
< body 
>  
< div 
  
 id 
 = 
 "chart_div" 
  
 style 
 = 
 "width: 900px; height: 500px;" 
>< / 
 div 
>  
< / 
 body 
>
< / 
 html 
>

Some simple examples

Unlike the chart in the previous section, most charts have just one series. Here's an example of a line chart with 20pt circular points:

Since the default pointShape is the circle, we can leave it out of the options:

Options
  
 var 
  
 options 
  
 = 
  
 { 
  
 legend 
 : 
  
 'none' 
 , 
  
 hAxis 
 : 
  
 { 
  
 minValue 
 : 
  
 0 
 , 
  
 maxValue 
 : 
  
 9 
  
 }, 
  
 curveType 
 : 
  
 'function' 
 , 
  
  pointSize 
 : 
  
 20 
 
 , 
  
 }; 
Full HTML
  
< head 
>  
< script 
  
 type 
 = 
 "text/javascript" 
  
 src 
 = 
 "https://www.gstatic.com/charts/loader.js" 
>< / 
 script 
>  
< script 
  
 type 
 = 
 "text/javascript" 
>  
 google 
 . 
 charts 
 . 
 load 
 ( 
 "current" 
 , 
  
 { 
 packages 
 :[ 
 "corechart" 
 ]}); 
  
 google 
 . 
 charts 
 . 
 setOnLoadCallback 
 ( 
 drawChart 
 ); 
  
 function 
  
 drawChart 
 () 
  
 { 
  
 var 
  
 data 
  
 = 
  
 google 
 . 
 visualization 
 . 
 arrayToDataTable 
  
 ([[ 
 'X' 
 , 
  
 'Y' 
 ], 
  
 [ 
 1 
 , 
  
 3 
 ], 
  
 [ 
 2 
 , 
  
 2.5 
 ], 
  
 [ 
 3 
 , 
  
 3 
 ], 
  
 [ 
 4 
 , 
  
 4 
 ], 
  
 [ 
 5 
 , 
  
 4 
 ], 
  
 [ 
 6 
 , 
  
 3 
 ], 
  
 [ 
 7 
 , 
  
 2.5 
 ], 
  
 [ 
 8 
 , 
  
 3 
 ] 
  
 ]); 
  
 var 
  
 options 
  
 = 
  
 { 
  
 legend 
 : 
  
 'none' 
 , 
  
 hAxis 
 : 
  
 { 
  
 minValue 
 : 
  
 0 
 , 
  
 maxValue 
 : 
  
 9 
  
 }, 
  
 curveType 
 : 
  
 'function' 
 , 
  
  pointSize 
 : 
  
 20 
 
 , 
  
 }; 
  
 var 
  
 chart 
  
 = 
  
 new 
  
 google 
 . 
 visualization 
 . 
 LineChart 
 ( 
 document 
 . 
 getElementById 
 ( 
 'chart_div' 
 )); 
  
 chart 
 . 
 draw 
 ( 
 data 
 , 
  
 options 
 ); 
  
 } 
  
< / 
 script 
>  
< / 
 head 
>  
< body 
>  
< div 
  
 id 
 = 
 "chart_div" 
  
 style 
 = 
 "width: 900px; height: 500px;" 
>< / 
 div 
>  
< / 
 body 
>
< / 
 html 
>

You can change it from "circle" to another shape by setting pointShape to "triangle", "square", "diamond", "star", or "polygon":

Options
  
 var 
  
 options 
  
 = 
  
 { 
  
 legend 
 : 
  
 'none' 
 , 
  
 hAxis 
 : 
  
 { 
  
 minValue 
 : 
  
 0 
 , 
  
 maxValue 
 : 
  
 9 
  
 }, 
  
 colors 
 : 
  
 [ 
 '#795548' 
 ], 
  
 pointSize 
 : 
  
 20 
 , 
  
  pointShape 
 : 
  
 'square' 
 
  
 }; 
Full HTML
  
< head 
>  
< script 
  
 type 
 = 
 "text/javascript" 
  
 src 
 = 
 "https://www.gstatic.com/charts/loader.js" 
>< / 
 script 
>  
< script 
  
 type 
 = 
 "text/javascript" 
>  
 google 
 . 
 charts 
 . 
 load 
 ( 
 "current" 
 , 
  
 { 
 packages 
 :[ 
 "corechart" 
 ]}); 
  
 google 
 . 
 charts 
 . 
 setOnLoadCallback 
 ( 
 drawChart 
 ); 
  
 function 
  
 drawChart 
 () 
  
 { 
  
 var 
  
 data 
  
 = 
  
 google 
 . 
 visualization 
 . 
 arrayToDataTable 
  
 ([[ 
 'X' 
 , 
  
 'Y' 
 ], 
  
 [ 
 1 
 , 
  
 3 
 ], 
  
 [ 
 2 
 , 
  
 2.5 
 ], 
  
 [ 
 3 
 , 
  
 3 
 ], 
  
 [ 
 4 
 , 
  
 4 
 ], 
  
 [ 
 5 
 , 
  
 4 
 ], 
  
 [ 
 6 
 , 
  
 3 
 ], 
  
 [ 
 7 
 , 
  
 2.5 
 ], 
  
 [ 
 8 
 , 
  
 3 
 ] 
  
 ]); 
  
 var 
  
 options 
  
 = 
  
 { 
  
 legend 
 : 
  
 'none' 
 , 
  
 hAxis 
 : 
  
 { 
  
 minValue 
 : 
  
 0 
 , 
  
 maxValue 
 : 
  
 9 
  
 }, 
  
 colors 
 : 
  
 [ 
 '#795548' 
 ], 
  
 pointSize 
 : 
  
 20 
 , 
  
  pointShape 
 : 
  
 'square' 
 
  
 }; 
  
 var 
  
 chart 
  
 = 
  
 new 
  
 google 
 . 
 visualization 
 . 
 LineChart 
 ( 
 document 
 . 
 getElementById 
 ( 
 'chart_div' 
 )); 
  
 chart 
 . 
 draw 
 ( 
 data 
 , 
  
 options 
 ); 
  
 } 
  
< / 
 script 
>  
< / 
 head 
>  
< body 
>  
< div 
  
 id 
 = 
 "chart_div" 
  
 style 
 = 
 "width: 900px; height: 500px;" 
>< / 
 div 
>  
< / 
 body 
>
< / 
 html 
>

The 'star' and 'polygon' shapes let you customize the number of sides, both defaulting to five. Some four-sided stars:

Options
  
 var 
  
 options 
  
 = 
  
 { 
  
 legend 
 : 
  
 'none' 
 , 
  
 hAxis 
 : 
  
 { 
  
 minValue 
 : 
  
 0 
 , 
  
 maxValue 
 : 
  
 9 
  
 }, 
  
 colors 
 : 
  
 [ 
 '#EF851C' 
 ], 
  
 pointSize 
 : 
  
 30 
 , 
  
  pointShape 
 : 
  
 { 
  
 type 
 : 
  
 'star' 
 , 
  
 sides 
 : 
  
 4 
  
 } 
 
  
 }; 
Full HTML
< html 
>  
< head 
>  
< script 
  
 type 
 = 
 "text/javascript" 
  
 src 
 = 
 "https://www.gstatic.com/charts/loader.js" 
>< / 
 script 
>  
< script 
  
 type 
 = 
 "text/javascript" 
>  
 google 
 . 
 charts 
 . 
 load 
 ( 
 "current" 
 , 
  
 { 
 packages 
 :[ 
 "corechart" 
 ]}); 
  
 google 
 . 
 charts 
 . 
 setOnLoadCallback 
 ( 
 drawChart 
 ); 
  
 function 
  
 drawChart 
 () 
  
 { 
  
 var 
  
 data 
  
 = 
  
 google 
 . 
 visualization 
 . 
 arrayToDataTable 
  
 ([[ 
 'X' 
 , 
  
 'Y' 
 ], 
  
 [ 
 1 
 , 
  
 3 
 ], 
  
 [ 
 2 
 , 
  
 2.5 
 ], 
  
 [ 
 3 
 , 
  
 3 
 ], 
  
 [ 
 4 
 , 
  
 4 
 ], 
  
 [ 
 5 
 , 
  
 4 
 ], 
  
 [ 
 6 
 , 
  
 3 
 ], 
  
 [ 
 7 
 , 
  
 2.5 
 ], 
  
 [ 
 8 
 , 
  
 3 
 ] 
  
 ]); 
  
 var 
  
 options 
  
 = 
  
 { 
  
 legend 
 : 
  
 'none' 
 , 
  
 hAxis 
 : 
  
 { 
  
 minValue 
 : 
  
 0 
 , 
  
 maxValue 
 : 
  
 9 
  
 }, 
  
 colors 
 : 
  
 [ 
 '#EF851C' 
 ], 
  
 pointSize 
 : 
  
 30 
 , 
  
  pointShape 
 : 
  
 { 
  
 type 
 : 
  
 'star' 
 , 
  
 sides 
 : 
  
 4 
  
 } 
 
  
 }; 
  
 var 
  
 chart 
  
 = 
  
 new 
  
 google 
 . 
 visualization 
 . 
 LineChart 
 ( 
 document 
 . 
 getElementById 
 ( 
 'chart_div' 
 )); 
  
 chart 
 . 
 draw 
 ( 
 data 
 , 
  
 options 
 ); 
  
 } 
  
< / 
 script 
>  
< / 
 head 
>  
< body 
>  
< div 
  
 id 
 = 
 "chart_div" 
  
 style 
 = 
 "width: 900px; height: 500px;" 
>< / 
 div 
>  
< / 
 body 
>
< / 
 html 
>

Stars can be further customized with the dent option, which controls how concave the star is. When the dent is close to zero, the star will be starfish-like; as the dent approaches one, it'll bloat past an equilateral polygon.

Here are dents ranging from 0.05 to 0.8 for five sided stars:

Options
 var 
  
 options 
  
 = 
  
 { 
  
 legend 
 : 
  
 'none' 
 , 
  
 hAxis 
 : 
  
 { 
  
 textPosition 
 : 
  
 'none' 
  
 }, 
  
 vAxis 
 : 
  
 { 
  
 textPosition 
 : 
  
 'none' 
 , 
  
 gridlines 
 : 
  
 { 
  
 count 
 : 
  
 0 
  
 }, 
  
 baselineColor 
 : 
  
 'white' 
  
 }, 
  
 colors 
 : 
  
 [ 
 '#E94D20' 
 , 
  
 '#ECA403' 
 , 
  
 '#63A74A' 
 , 
  
 '#15A0C8' 
 , 
  
 '#4151A3' 
 , 
  
 '#703593' 
 , 
  
 '#981B48' 
 ], 
  
 pointSize 
 : 
  
 20 
 , 
  
 annotations 
 : 
  
 { 
  
 stemColor 
 : 
  
 'white' 
 , 
  
 textStyle 
 : 
  
 { 
  
 fontSize 
 : 
  
 16 
  
 } 
  
 }, 
  
 series 
 : 
  
 { 
  
 0 
 : 
  
 { 
  
 pointShape 
 : 
  
 { 
  
 type 
 : 
  
 'star' 
 , 
  
 sides 
 : 
  
 5 
 , 
  
  dent 
 : 
  
 0.05 
 
  
 } 
  
 }, 
  
 1 
 : 
  
 { 
  
 pointShape 
 : 
  
 { 
  
 type 
 : 
  
 'star' 
 , 
  
 sides 
 : 
  
 5 
 , 
  
  dent 
 : 
  
 0.1 
 
  
 } 
  
 }, 
  
 2 
 : 
  
 { 
  
 pointShape 
 : 
  
 { 
  
 type 
 : 
  
 'star' 
 , 
  
 sides 
 : 
  
 5 
 , 
  
  dent 
 : 
  
 0.2 
 
  
 } 
  
 }, 
  
 3 
 : 
  
 { 
  
 pointShape 
 : 
  
 { 
  
 type 
 : 
  
 'star' 
 , 
  
 sides 
 : 
  
 5 
  
 } 
  
 }, 
  
 4 
 : 
  
 { 
  
 pointShape 
 : 
  
 { 
  
 type 
 : 
  
 'star' 
 , 
  
 sides 
 : 
  
 5 
 , 
  
  dent 
 : 
  
 0.5 
 
  
 } 
  
 }, 
  
 5 
 : 
  
 { 
  
 pointShape 
 : 
  
 { 
  
 type 
 : 
  
 'star' 
 , 
  
 sides 
 : 
  
 5 
 , 
  
  dent 
 : 
  
 0.7 
 
  
 } 
  
 }, 
  
 6 
 : 
  
 { 
  
 pointShape 
 : 
  
 { 
  
 type 
 : 
  
 'star' 
 , 
  
 sides 
 : 
  
 5 
 , 
  
  dent 
 : 
  
 0.8 
 
  
 } 
  
 }, 
  
 } 
 }; 
Full HTML
< html 
>  
< head 
>  
< script 
  
 type 
 = 
 "text/javascript" 
  
 src 
 = 
 "https://www.gstatic.com/charts/loader.js" 
>< / 
 script 
>  
< script 
  
 type 
 = 
 "text/javascript" 
>  
 google 
 . 
 charts 
 . 
 load 
 ( 
 "current" 
 , 
  
 { 
 packages 
 :[ 
 "corechart" 
 ]}); 
  
 google 
 . 
 charts 
 . 
 setOnLoadCallback 
 ( 
 drawChart 
 ); 
  
 function 
  
 drawChart 
 () 
  
 { 
  
 var 
  
 data 
  
 = 
  
 new 
  
 google 
 . 
 visualization 
 . 
 DataTable 
 (); 
  
 data 
 . 
 addColumn 
 ( 
 'string' 
 , 
  
 'Element' 
 ); 
  
 data 
 . 
 addColumn 
 ( 
 'number' 
 , 
  
 'A' 
 ); 
  
 data 
 . 
 addColumn 
 ( 
  
 { 
  
 type 
 : 
  
 'string' 
 , 
  
 role 
 : 
  
 'annotation' 
  
 }); 
  
 data 
 . 
 addColumn 
 ( 
 'number' 
 , 
  
 'B' 
 ); 
  
 data 
 . 
 addColumn 
 ( 
  
 { 
  
 type 
 : 
  
 'string' 
 , 
  
 role 
 : 
  
 'annotation' 
  
 }); 
  
 data 
 . 
 addColumn 
 ( 
 'number' 
 , 
  
 'C' 
 ); 
  
 data 
 . 
 addColumn 
 ( 
  
 { 
  
 type 
 : 
  
 'string' 
 , 
  
 role 
 : 
  
 'annotation' 
  
 }); 
  
 data 
 . 
 addColumn 
 ( 
 'number' 
 , 
  
 'D' 
 ); 
  
 data 
 . 
 addColumn 
 ( 
  
 { 
  
 type 
 : 
  
 'string' 
 , 
  
 role 
 : 
  
 'annotation' 
  
 }); 
  
 data 
 . 
 addColumn 
 ( 
 'number' 
 , 
  
 'E' 
 ); 
  
 data 
 . 
 addColumn 
 ( 
  
 { 
  
 type 
 : 
  
 'string' 
 , 
  
 role 
 : 
  
 'annotation' 
  
 }); 
  
 data 
 . 
 addColumn 
 ( 
 'number' 
 , 
  
 'F' 
 ); 
  
 data 
 . 
 addColumn 
 ( 
  
 { 
  
 type 
 : 
  
 'string' 
 , 
  
 role 
 : 
  
 'annotation' 
  
 }); 
  
 data 
 . 
 addColumn 
 ( 
 'number' 
 , 
  
 'G' 
 ); 
  
 data 
 . 
 addColumn 
 ( 
  
 { 
  
 type 
 : 
  
 'string' 
 , 
  
 role 
 : 
  
 'annotation' 
  
 }); 
  
 data 
 . 
 addRow 
 ([ 
 'A' 
 , 
  
 1 
 , 
  
 "dent: 0.05" 
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 null 
 ]); 
  
 data 
 . 
 addRow 
 ([ 
 'B' 
 , 
  
 , 
  
 , 
  
 1 
 , 
  
 "dent: 0.1" 
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 null 
 ]); 
  
 data 
 . 
 addRow 
 ([ 
 'C' 
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 1 
 , 
  
 "dent: 0.2" 
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 null 
 ]); 
  
 data 
 . 
 addRow 
 ([ 
 'D' 
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 1 
 , 
  
 "default" 
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 null 
 ]); 
  
 data 
 . 
 addRow 
 ([ 
 'E' 
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 1 
 , 
  
 "dent: 0.5" 
 , 
  
 , 
  
 , 
  
 , 
  
 null 
 ]); 
  
 data 
 . 
 addRow 
 ([ 
 'F' 
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 1 
 , 
  
 "dent: 0.7" 
 , 
  
 , 
  
 null 
 ]); 
  
 data 
 . 
 addRow 
 ([ 
 'G' 
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 , 
  
 1 
 , 
  
 "dent: 0.8" 
 ]); 
  
 var 
  
 options 
  
 = 
  
 { 
  
 legend 
 : 
  
 'none' 
 , 
  
 hAxis 
 : 
  
 { 
  
 textPosition 
 : 
  
 'none' 
  
 }, 
  
 vAxis 
 : 
  
 { 
  
 textPosition 
 : 
  
 'none' 
 , 
  
 gridlines 
 : 
  
 { 
  
 count 
 : 
  
 0 
  
 }, 
  
 baselineColor 
 : 
  
 'white' 
  
 }, 
  
 colors 
 : 
  
 [ 
 '#E94D20' 
 , 
  
 '#ECA403' 
 , 
  
 '#63A74A' 
 , 
  
 '#15A0C8' 
 , 
  
 '#4151A3' 
 , 
  
 '#703593' 
 , 
  
 '#981B48' 
 ], 
  
 pointSize 
 : 
  
 20 
 , 
  
 annotations 
 : 
  
 { 
  
 stemColor 
 : 
  
 'white' 
 , 
  
 textStyle 
 : 
  
 { 
  
 fontSize 
 : 
  
 16 
  
 } 
  
 }, 
  
 series 
 : 
  
 { 
  
 0 
 : 
  
 { 
  
 pointShape 
 : 
  
 { 
  
 type 
 : 
  
 'star' 
 , 
  
 sides 
 : 
  
 5 
 , 
  
  dent 
 : 
  
 0.05 
 
  
 } 
  
 }, 
  
 1 
 : 
  
 { 
  
 pointShape 
 : 
  
 { 
  
 type 
 : 
  
 'star' 
 , 
  
 sides 
 : 
  
 5 
 , 
  
  dent 
 : 
  
 0.1 
 
  
 } 
  
 }, 
  
 2 
 : 
  
 { 
  
 pointShape 
 : 
  
 { 
  
 type 
 : 
  
 'star' 
 , 
  
 sides 
 : 
  
 5 
 , 
  
  dent 
 : 
  
 0.2 
 
  
 } 
  
 }, 
  
 3 
 : 
  
 { 
  
 pointShape 
 : 
  
 { 
  
 type 
 : 
  
 'star' 
 , 
  
 sides 
 : 
  
 5 
  
 } 
  
 }, 
  
 4 
 : 
  
 { 
  
 pointShape 
 : 
  
 { 
  
 type 
 : 
  
 'star' 
 , 
  
 sides 
 : 
  
 5 
 , 
  
  dent 
 : 
  
 0.5 
 
  
 } 
  
 }, 
  
 5 
 : 
  
 { 
  
 pointShape 
 : 
  
 { 
  
 type 
 : 
  
 'star' 
 , 
  
 sides 
 : 
  
 5 
 , 
  
  dent 
 : 
  
 0.7 
 
  
 } 
  
 }, 
  
 6 
 : 
  
 { 
  
 pointShape 
 : 
  
 { 
  
 type 
 : 
  
 'star' 
 , 
  
 sides 
 : 
  
 5 
 , 
  
  dent 
 : 
  
 0.8 
 
  
 } 
  
 }, 
  
 } 
  
 }; 
  
 var 
  
 chart 
  
 = 
  
 new 
  
 google 
 . 
 visualization 
 . 
 LineChart 
 ( 
 document 
 . 
 getElementById 
 ( 
 'chart_div' 
 )); 
  
 chart 
 . 
 draw 
 ( 
 data 
 , 
  
 options 
 ); 
  
 } 
  
< / 
 script 
>  
< / 
 head 
>  
< body 
>  
< div 
  
 id 
 = 
 "chart_div" 
  
 style 
 = 
 "width: 900px; height: 500px;" 
>< / 
 div 
>  
< / 
 body 
>
< / 
 html 
>

Rotations

All point shapes can be rotated with the rotation option, specified in degrees. For instance, we can make our triangles point downward in the following area chart by rotating them 180 degrees:

Options
  
 var 
  
 options 
  
 = 
  
 { 
  
 legend 
 : 
  
 'none' 
 , 
  
 colors 
 : 
  
 [ 
 '#15A0C8' 
 ], 
  
 pointSize 
 : 
  
 30 
 , 
  
  pointShape 
 : 
  
 { 
  
 type 
 : 
  
 'triangle' 
 , 
  
 rotation 
 : 
  
 180 
  
 } 
 
  
 }; 
Full HTML
  
< head 
>  
< script 
  
 type 
 = 
 "text/javascript" 
  
 src 
 = 
 "https://www.gstatic.com/charts/loader.js" 
>< / 
 script 
>  
< script 
  
 type 
 = 
 "text/javascript" 
>  
 google 
 . 
 charts 
 . 
 load 
 ( 
 "current" 
 , 
  
 { 
 packages 
 :[ 
 "corechart" 
 ]}); 
  
 google 
 . 
 charts 
 . 
 setOnLoadCallback 
 ( 
 drawChart 
 ); 
  
 function 
  
 drawChart 
 () 
  
 { 
  
 var 
  
 data 
  
 = 
  
 google 
 . 
 visualization 
 . 
 arrayToDataTable 
  
 ([[ 
 'X' 
 , 
  
 'Y' 
 ], 
  
 [ 
 1 
 , 
  
 3 
 ], 
  
 [ 
 2 
 , 
  
 2.5 
 ], 
  
 [ 
 3 
 , 
  
 2 
 ], 
  
 [ 
 4 
 , 
  
 3 
 ], 
  
 [ 
 5 
 , 
  
 4.5 
 ], 
  
 [ 
 6 
 , 
  
 6.5 
 ], 
  
 [ 
 7 
 , 
  
 9 
 ], 
  
 [ 
 8 
 , 
  
 12 
 ] 
  
 ]); 
  
 var 
  
 options 
  
 = 
  
 { 
  
 legend 
 : 
  
 'none' 
 , 
  
 colors 
 : 
  
 [ 
 '#15A0C8' 
 ], 
  
 pointSize 
 : 
  
 30 
 , 
  
  pointShape 
 : 
  
 { 
  
 type 
 : 
  
 'triangle' 
 , 
  
 rotation 
 : 
  
 180 
  
 } 
 
  
 }; 
  
 var 
  
 chart 
  
 = 
  
 new 
  
 google 
 . 
 visualization 
 . 
 AreaChart 
 ( 
 document 
 . 
 getElementById 
 ( 
 'chart_div' 
 )); 
  
 chart 
 . 
 draw 
 ( 
 data 
 , 
  
 options 
 ); 
  
 } 
  
< / 
 script 
>  
< / 
 head 
>  
< body 
>  
< div 
  
 id 
 = 
 "chart_div" 
  
 style 
 = 
 "width: 900px; height: 500px;" 
>< / 
 div 
>  
< / 
 body 
>
< / 
 html 
>

Customizing individual points

By default, the styles applied to a point apply to all points in the series. If you want to change the appearance of a particular data point, you can do so by styling it.

In the following chart, we increase the size of one of the points, lower the opacity to 0.3, and change the shape and color:

<html>
  <head>
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <script type="text/javascript">
      google.charts.load('current', {'packages':['corechart']});
      google.charts.setOnLoadCallback(drawChart);

      function drawChart() {
        var data = google.visualization.arrayToDataTable
            ([['X', 'Y', {'type': 'string', 'role': 'style'}],
              [1, 3, null],
              [2, 2.5, null],
              [3, 3, null],
              [4, 4, null],
              [5, 4, null],
              [6, 3, 'point { size: 18; shape-type: star; fill-color: #a52714; }'],
              [7, 2.5, null],
              [8, 3, null]
        ]);

        var options = {
          legend: 'none',
          hAxis: { minValue: 0, maxValue: 9 },
          curveType: 'function',
          pointSize: 7,
          dataOpacity: 0.3
        };

        var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
        chart.draw(data, options);
    }
    </script>
  </head>
  <body>
    <div id="chart_div" style="width: 900px; height: 500px;"></div>
  </body>
</html>

The following style customizations are available:

  • fill-color (Specified as a hex string.)
  • shape-dent
  • shape-rotation
  • shape-sides
  • shape-type
  • stroke-color (Specified as a hex string.)
  • stroke-width (Specified as a hex string.)
  • size
  • visible (Whether the point is visible or not.)

The opacity is controlled not through a style, but with the dataOpacity option.

Create a Mobile Website
View Site in Mobile | Classic
Share by: