Looking for a chart that produces a "Square" wave

35 views
Skip to first unread message

Jediah Dizon

unread,
Mar 1, 2016, 10:18:10 AM3/1/16
to Google Visualization API
Okay, so say I have a room that has a light. I need a chart that collects when the light is on and off at a specified time range. Strictly "boolean" datatype for the Y-Axis, and "date" datatype for the X-Axis. Apparently, I can't find a chart that can do that. If you know a chart that can do that, tell me.! I really appreciate it. Thanks!

Daniel LaLiberte

unread,
Mar 1, 2016, 10:29:48 AM3/1/16
to Google Visualization API
Jediah, that sounds like the SteppedArea chart.  You can turn off the area with the areaOpacity option, so you'll get a stepped line chart.

On Tue, Mar 1, 2016 at 10:18 AM, Jediah Dizon <jediah...@gmail.com> wrote:
Okay, so say I have a room that has a light. I need a chart that collects when the light is on and off at a specified time range. Strictly "boolean" datatype for the Y-Axis, and "date" datatype for the X-Axis. Apparently, I can't find a chart that can do that. If you know a chart that can do that, tell me.! I really appreciate it. Thanks!

--
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 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/0f36e791-302c-495f-a374-b5a28e29569c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Jediah Dizon

unread,
Mar 1, 2016, 2:07:46 PM3/1/16
to Google Visualization API
Hello Daniel!
Thanks for the answer. It's really helpful. Although, I'm having trouble trying to implement the chart with the appropriate datatypes. In this case, boolean causes the error "cannot read property of null" and I am having trouble trying to implement it. 
Here's the snippet of my code: 

---
function drawChart() {
        var data = new google.visualization.DataTable();
data.addColumn('date', 'X');
data.addColumn('boolean', 'Light');
data.addRows([
        [new Date("February 15, 2015"), true],
        [new Date("February 28, 2015"), true],
        [new Date("March 15, 2015"), true]
      ]);
---
I'd really appreciate it if you could help me out.! I'm doing this for a CAPSTONE project for my college, and I have been spending hours straight trying to find a solution. Again, I'd really appreciate it if you could help me make it work. Thanks!


On Tuesday, March 1, 2016 at 8:29:48 AM UTC-7, Daniel LaLiberte wrote:
Jediah, that sounds like the SteppedArea chart.  You can turn off the area with the areaOpacity option, so you'll get a stepped line chart.
On Tue, Mar 1, 2016 at 10:18 AM, Jediah Dizon <jediah...@gmail.com> wrote:
Okay, so say I have a room that has a light. I need a chart that collects when the light is on and off at a specified time range. Strictly "boolean" datatype for the Y-Axis, and "date" datatype for the X-Axis. Apparently, I can't find a chart that can do that. If you know a chart that can do that, tell me.! I really appreciate it. Thanks!

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



--

Daniel LaLiberte

unread,
Mar 1, 2016, 2:20:37 PM3/1/16
to Google Visualization API
Boolean is an allowed data type in DataTables, but it has limited uses, and can't be used as if it were numeric for charting purposes.  So use 0 and 1 instead.  If you want the axis to show labels with true and false, or something similar, then you can use the explicit 'ticks' option like so:  vAxis: { ticks: [ {v:0, f: 'false'}, { v:1, f: 'true' } ] }


On Tue, Mar 1, 2016 at 2:07 PM, Jediah Dizon <jediah...@gmail.com> wrote:
Hello Daniel!
Thanks for the answer. It's really helpful. Although, I'm having trouble trying to implement the chart with the appropriate datatypes. In this case, boolean causes the error "cannot read property of null" and I am having trouble trying to implement it. 
Here's the snippet of my code: 

---
function drawChart() {
        var data = new google.visualization.DataTable();
data.addColumn('date', 'X');
data.addColumn('boolean', 'Light');
data.addRows([
        [new Date("February 15, 2015"), true],
        [new Date("February 28, 2015"), true],
        [new Date("March 15, 2015"), true]
      ]);
---
I'd really appreciate it if you could help me out.! I'm doing this for a CAPSTONE project for my college, and I have been spending hours straight trying to find a solution. Again, I'd really appreciate it if you could help me make it work. Thanks!


On Tuesday, March 1, 2016 at 8:29:48 AM UTC-7, Daniel LaLiberte wrote:
Jediah, that sounds like the SteppedArea chart.  You can turn off the area with the areaOpacity option, so you'll get a stepped line chart.
On Tue, Mar 1, 2016 at 10:18 AM, Jediah Dizon <jediah...@gmail.com> wrote:
Okay, so say I have a room that has a light. I need a chart that collects when the light is on and off at a specified time range. Strictly "boolean" datatype for the Y-Axis, and "date" datatype for the X-Axis. Apparently, I can't find a chart that can do that. If you know a chart that can do that, tell me.! I really appreciate it. Thanks!

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



--

--
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 https://groups.google.com/group/google-visualization-api.

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



--

Jediah Dizon

unread,
Mar 1, 2016, 2:35:17 PM3/1/16
to Google Visualization API
Oh okay. That's unfortunate. Nevertheless, very informative. I'll take note of the suggestion.
Thank you Daniel. I appreciate it.


On Tuesday, March 1, 2016 at 12:20:37 PM UTC-7, Daniel LaLiberte wrote:
Boolean is an allowed data type in DataTables, but it has limited uses, and can't be used as if it were numeric for charting purposes.  So use 0 and 1 instead.  If you want the axis to show labels with true and false, or something similar, then you can use the explicit 'ticks' option like so:  vAxis: { ticks: [ {v:0, f: 'false'}, { v:1, f: 'true' } ] }

On Tue, Mar 1, 2016 at 2:07 PM, Jediah Dizon <jediah...@gmail.com> wrote:
Hello Daniel!
Thanks for the answer. It's really helpful. Although, I'm having trouble trying to implement the chart with the appropriate datatypes. In this case, boolean causes the error "cannot read property of null" and I am having trouble trying to implement it. 
Here's the snippet of my code: 

---
function drawChart() {
        var data = new google.visualization.DataTable();
data.addColumn('date', 'X');
data.addColumn('boolean', 'Light');
data.addRows([
        [new Date("February 15, 2015"), true],
        [new Date("February 28, 2015"), true],
        [new Date("March 15, 2015"), true]
      ]);
---
I'd really appreciate it if you could help me out.! I'm doing this for a CAPSTONE project for my college, and I have been spending hours straight trying to find a solution. Again, I'd really appreciate it if you could help me make it work. Thanks!


On Tuesday, March 1, 2016 at 8:29:48 AM UTC-7, Daniel LaLiberte wrote:
Jediah, that sounds like the SteppedArea chart.  You can turn off the area with the areaOpacity option, so you'll get a stepped line chart.
On Tue, Mar 1, 2016 at 10:18 AM, Jediah Dizon <jediah...@gmail.com> wrote:
Okay, so say I have a room that has a light. I need a chart that collects when the light is on and off at a specified time range. Strictly "boolean" datatype for the Y-Axis, and "date" datatype for the X-Axis. Apparently, I can't find a chart that can do that. If you know a chart that can do that, tell me.! I really appreciate it. Thanks!

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



--

--
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-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.



--
Reply all
Reply to author
Forward
0 new messages