drawChartFromRecords

This sample code does not work as expected. See inline comments.
var options = {}; options.title="Popularity of Hashtags over time"; options.colors = ["yellow", "green"]; options.legend = {position: "left"}; //Uncomment and test any of these options. They do not have any effect on the chart. //options.legend = {position: "top"}; // does not work //options.legend = {position: "bottom"}; // does not work //options.legend = {position: "hide"}; // does not work //options.bars = "vertical"; // does not work drawChartFromRecords("chart1", "line", "hashtags", ["monthsSinceJan2012", "tbtPopularity", "nofilterPopularity"], options);
I used the default dataset provided with this level.

Hi @mmathews,

Great questions and thanks for providing the code! Did you uncomment these one at a time? My code seemed to work here, but here are some thoughts on what might be going wrong:

  • For the “hide” legend setting, it should actually be “none”, not “hide”
  • I think the “bars” aren’t showing up because it is a “line” chart you are making. If you make it a “bar” chart, then you should be able to flip the bars vertically or horizontally.

I could not figure out how to get “top” and “bottom” to work. From what I read it SHOULD work, but it certainly wasn’t for me… I will look into it further!

Hopefully in the short term this is helpful!
KT

1 Like

@kaitie_o_bryan, Thank you. Your hints on the “hide” for position and “vertical” for bar chart are definitely helpful. Maybe this information can be included in the documentation for the drawChartFromRecords().

@mmathews thanks for writing in. We definitely know we need to do some cleanup work on the Post AP unit but given all the other pressures on the curriculum it’s not something we were able to get to this year. Hoping to do more next time around but we do appreciate the feedback.