Google LineChart How to set default Point style in options?

865 views
Skip to first unread message

Georgess

unread,
Mar 1, 2017, 1:56:53 PM3/1/17
to Google Visualization API

Instead of setting style for each point in data I want to set style only once in var options.

For example pointStyle: {shape-type: square,  stroke-width: 4, fill-color: 'transparent', stroke-color: 'red' }

How it can be done?

var options = {

          legend: 'none',
          hAxis: { minValue: 0, maxValue: 9 },
          curveType: 'function',
          pointSize: 7,
          dataOpacity: 0.8,
       
          pointStyle: {shape-type: square,  stroke-width: 4, fill-color: 'transparent', stroke-color: 'red' }
      
        };

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,  'point { size: 8; shape-type: circle; fill-color: orange;}'],

              [5, 4, 'point  {shape-type: square; size: 10; stroke-width: 2; fill-color: transparent; stroke-color: red;}'],

              [6, 3, 'point  { size: 18; shape-type: star; fill-color: #a52714; }'],
              [7, 2.5, null],
              [8, 3, null]
        ]);

Daniel LaLiberte

unread,
Mar 1, 2017, 2:17:14 PM3/1/17
to Google Visualization API
Good idea, but we don't support a single default pointStyle option for all series.  You'll have to instead set the separate options for pointSize, pointShape, dataOpacity, colors, and lineWidth. Or for a particular series, you can use several slightly different options, e.g. 

 var options = {
    series: {
      0: { color: 'black', pointSize: 7, lineWidth: 4 }
    }

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/195eeb2b-9056-4ef5-ae34-8c1c016d632a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages