# drawChartFromRecords

**URL:** <https://forum.code.org/t/drawchartfromrecords/16220>\
**Category:** Unit and Lesson Discussion\
**Tags:** applab, csp-unit-post-ap\
**Created:** [May 14, 2018, 8:46pm UTC](https://forum.code.org/t/drawchartfromrecords/16220 "2018-05-14T20:46:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmathews](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/mmathews/32/4419_2.png) [@mmathews](https://forum.code.org/u/mmathews)\
**Post date:** [May 14, 2018, 8:46pm UTC](https://forum.code.org/t/drawchartfromrecords/16220/1 "2018-05-14T20:46:49Z")

</div>

> **[Code.org](https://studio.code.org/users/sign_in)**
>
> Anyone can learn computer science. Make games, apps and art with code.

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.

---

<div class="post-metadata">

**Author:** ![kaitie\_o\_bryan](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/kaitie_o_bryan/32/2278_2.png) [@kaitie\_o\_bryan](https://forum.code.org/u/kaitie_o_bryan)\
**Post date:** [May 15, 2018, 3:27am UTC](https://forum.code.org/t/drawchartfromrecords/16220/2 "2018-05-15T03:27:55Z")

</div>

Hi @mmathews,

Great questions and thanks for providing the code! Did you uncomment these one at a time? My code seemed to work [here](https://studio.code.org/projects/applab/4_q0bwWeU3NIkAK3i9GDEA), 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

---

<div class="post-metadata">

**Author:** ![mmathews](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/mmathews/32/4419_2.png) [@mmathews](https://forum.code.org/u/mmathews)\
**Post date:** [May 15, 2018, 3:07pm UTC](https://forum.code.org/t/drawchartfromrecords/16220/3 "2018-05-15T15:07:27Z")

</div>

@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().

---

<div class="post-metadata">

**Author:** ![gtwrobel](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/gtwrobel/32/3576_2.png) [@gtwrobel](https://forum.code.org/u/gtwrobel)\
**Post date:** [May 15, 2018, 9:21pm UTC](https://forum.code.org/t/drawchartfromrecords/16220/4 "2018-05-15T21:21:33Z")

</div>

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