Question about step line chart.

35 views
Skip to first unread message

logical...@gmail.com

unread,
Nov 4, 2015, 2:19:10 AM11/4/15
to Google Visualization API
I am looking for a step line chart.  I found the step area chart but they aren't what I am looking for.  I am looking for a chart where not all x values are mapped to a y.  Like one set could be [1,5],[5,8],[9,50] and the other set could be [4,10][3,5].  Is there something that can do that?  Can I use the api to draw it myself?  Sorry about asking such a noob question.

Daniel LaLiberte

unread,
Nov 4, 2015, 8:11:33 AM11/4/15
to Google Visualization API
You can change the area of a stepped area chart to be transparent, using the areaOpacity option set to 0, so only the line remains, if that is what you want.  I don't understand your example data, however. Perhaps you should sketch a chart that would show what you want.

On Wed, Nov 4, 2015 at 2:19 AM, <logical...@gmail.com> wrote:
I am looking for a step line chart.  I found the step area chart but they aren't what I am looking for.  I am looking for a chart where not all x values are mapped to a y.  Like one set could be [1,5],[5,8],[9,50] and the other set could be [4,10][3,5].  Is there something that can do that?  Can I use the api to draw it myself?  Sorry about asking such a noob question.

--
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-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/c4d66f48-54b7-4a5c-8887-c8d0f07c960a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
dlaliberte@Google.com   5CC, Cambridge MA
daniel.laliberte@GMail.com 9 Juniper Ridge Road, Acton MA
Message has been deleted

logical...@gmail.com

unread,
Nov 4, 2015, 1:40:48 PM11/4/15
to Google Visualization API
So I have 2 arrays, each contains the data for 1 line, but the 2 arrays have different number of elements, and each array might not contain all the x values of the other.
I'm hoping for a easy way to render that.

In the sample code it looked like all the arrays had to be the same size and all the x values must have a y value.  I was looking for a jagged array.  I guess for the missing x values I can just repeat the previous y value and make the array square.  Is there some other way besides doing that?

On Wednesday, November 4, 2015 at 7:11:33 AM UTC-6, Daniel LaLiberte wrote:
You can change the area of a stepped area chart to be transparent, using the areaOpacity option set to 0, so only the line remains, if that is what you want.  I don't understand your example data, however. Perhaps you should sketch a chart that would show what you want.
On Wed, Nov 4, 2015 at 2:19 AM, <logical...@gmail.com> wrote:
I am looking for a step line chart.  I found the step area chart but they aren't what I am looking for.  I am looking for a chart where not all x values are mapped to a y.  Like one set could be [1,5],[5,8],[9,50] and the other set could be [4,10][3,5].  Is there something that can do that?  Can I use the api to draw it myself?  Sorry about asking such a noob question.

--
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.



--
dlali...@Google.com   5CC, Cambridge MA
daniel.l...@GMail.com 9 Juniper Ridge Road, Acton MA

Daniel LaLiberte

unread,
Nov 4, 2015, 1:54:05 PM11/4/15
to Google Visualization API
I believe I understand what you are asking for now.  What you should do is merge your two arrays into one table, include all the x values in the first column, in order, and for each x value, include the y value in one of your two additional columns, and leave null values for the remainder.  So for the data you gave, the table would look like this:

var data = google.visualization.arrayToDataTable([
  [1, 5, null],
  [3, null, 5],
  [4, null, 10],
  [5, 8, null],
  [9, 50, null]
]);

Then, in your options, you want to interpolate between the null values by using the option interpolateNulls: true.   This option won't work for the steppedAreaChart, but will for a LineChart.


On Wed, Nov 4, 2015 at 1:40 PM, <logical...@gmail.com> wrote:
So I have 2 arrays, each contains the data for 1 line, but the 2 arrays have different number of elements, and each array might not contain all the x values of the other.
I'm hoping for a easy way to render that.

In the sample code it looked like all the arrays had to be the same size and all the x values must have a y value.  I was looking for a jagged array.  I guess for the missing x values I can just repeat the previous y value and make the array square.  Is there some other way besides doing that?

On Wednesday, November 4, 2015 at 7:11:33 AM UTC-6, Daniel LaLiberte wrote:
You can change the area of a stepped area chart to be transparent, using the areaOpacity option set to 0, so only the line remains, if that is what you want.  I don't understand your example data, however. Perhaps you should sketch a chart that would show what you want.
On Wed, Nov 4, 2015 at 2:19 AM, <logical...@gmail.com> wrote:
I am looking for a step line chart.  I found the step area chart but they aren't what I am looking for.  I am looking for a chart where not all x values are mapped to a y.  Like one set could be [1,5],[5,8],[9,50] and the other set could be [4,10][3,5].  Is there something that can do that?  Can I use the api to draw it myself?  Sorry about asking such a noob question.

--
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-visualizati...@googlegroups.com.



--
dlali...@Google.com   5CC, Cambridge MA
daniel.l...@GMail.com 9 Juniper Ridge Road, Acton MA

--
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-visualizati...@googlegroups.com.

To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.

For more options, visit https://groups.google.com/d/optout.



--
dlaliberte@Google.com   5CC, Cambridge MA
daniel.laliberte@GMail.com 9 Juniper Ridge Road, Acton MA
Reply all
Reply to author
Forward
0 new messages