Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1080709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:04:23+00:00 2026-05-16T22:04:23+00:00

I am using open flash chart 2 (the plugin) in my rails application. Everything

  • 0

I am using open flash chart 2 (the plugin) in my rails application. Everything is looking smooth except for the range on my x axis. I am creating a line to represent cell phone plan cost over a specific amount of usage and I’m generate 8 values, 1-5 are below the allowed usage while 6-8 are demonstrations of the cost for usage over the limit.

The problem I’m encountering is how to set the range of the X axis in ruby on rails to something specific to the data. Right now the values being displayed are the indexes of the array that I’m giving. When I try to hand a hash to the values the chart doesn’t even load at all.

So basically I need help getting a way to set the data for my line properly so that it displays correctly, right now it is treating every value as if it represents the x value of the index of the array.

Here is a screen shot which may be a better description than what I am saying: http://i163.photobucket.com/albums/t286/Xeno56/Screenshot.png Note that those values are correct just the range on the x-axis is incorrect, it should be something like 100, 200, 300, 400, 500, 600, 700

Code:

y = YAxis.new
y.set_range(0,100, 20)

x_legend = XLegend.new("Usage")
x_legend.set_style('{font-size: 20px; color: #778877}')

y_legend = YLegend.new("Cost")
y_legend.set_style('{font-size: 20px; color: #770077}')

chart =OpenFlashChart.new
chart.set_x_legend(x_legend)
chart.set_y_legend(y_legend)
chart.y_axis = y

line = Line.new
line.text = plan.name
line.width = 2
line.color = '#006633'
line.dot_size = 2
line.values = generate_data(plan)     
chart.add_element(line)

def generate_data(plan)
  values = []
  #generate below threshold numbers
  5.times do |x|
    usage = plan.usage / 5 * x 
    cost = plan.cost
    values << cost
  end
  #generate above threshold numbers
  3.times do |x|
    usage = plan.usage + ((plan.usage / 5) * x)
    cost = plan.cost + (usage * plan.overage)
    values << cost
  end
  return values
end

Also the other problem I’m having is I can’t just add a few points as any values I give are taken as x being the elements position in the array and y being the value, whereas I need to be able to specify the x and y values for each point so I don’t have to buffer my array with a bunch of null values

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T22:04:23+00:00Added an answer on May 16, 2026 at 10:04 pm

    I ended up ditching open flash chart 2 and going with Flotr

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm just doing a simple graph using Open Flash Chart http://teethgrinder.co.uk/open-flash-chart/ which shows the
I'm using Open Flash Chart to display some graphical data in my web page.
I'm using Open Flash Chart to create statistics and one of the things i
I am using a jquery plugin fancybox to open a flash game. The game
I'm using Open Flash Chart 2 to present graphs and charts in my website.
Hi I just define my custom action on facebook using open graph. After creating
I am new to this forum and to Open Flash Chart 2. I just
I had been using the open source Flash SDK, and was recently gifted CS4.
I'm building an AIR application. Basically, what I'm looking to do is using navigateToUrl()
I have a flash movie using Actionscript 3 with some buttons that open links

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.