# 将活动投票中的饼图改为柱状图

**URL:** <https://meta.discourse.org/t/change-pie-to-bar-in-active-poll/302712>\
**Category:** Support\
**Tags:** polls, rails-console\
**Created:** [2024年四月6日 18:13 UTC](https://meta.discourse.org/t/change-pie-to-bar-in-active-poll/302712 "2024-04-06T18:13:13Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Don](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/don/32/228726_2.png) [@Don](https://meta.discourse.org/u/Don)\
**Post date:** [2024年四月6日 19:33 UTC](https://meta.discourse.org/t/change-pie-to-bar-in-active-poll/302712/2 "2024-04-06T19:33:56Z")

</div>

你好 👋

我找到了这个主题。

> [@Updating old Polls](https://meta.discourse.org/t/updating-old-polls/137551?u=don):
>
> Continuing the discussion from [Discourse 2.4.0.beta8 Release Notes](https://meta.discourse.org/t/discourse-2-4-0-beta8-release-notes/135183/2): Fantastic to see pie charts! I guess it’s not possible to retro-actively change a Poll to pie chart format e.g. by sneakily inserting chartType=pie into the inserted text? (I couldn’t get it to respond to that change, even on Post Rebake). I was attempting to update some old Polls that would benefit from that presentation. Thanks!

我已经测试过了，现在运行正常。 🙂

> [@Updating old Polls](https://meta.discourse.org/t/updating-old-polls/137551/3?u=don):
>
> Just to add to the Solution: In my case my site usually has the poll in the first post of the Topic, so a quick way of getting to it on the rails console is this: myPost = Topic.find\_by(id: number-from-topic-url).posts.first.id myPoll = Poll.find\_by(post\_id: myPost) or if you really want to go crazy on one line (scroll right!): myPoll = Poll.find\_by(post\_id: Topic.find\_by(id: number-from-topic-url).posts.first.id) Then in this case, of course: myPoll.chart\_type = 'pie' myPoll.save

---

_[View the full topic](https://meta.discourse.org/t/change-pie-to-bar-in-active-poll/302712)._
