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

  • Home
  • SEARCH
  • 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 9103431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T01:37:50+00:00 2026-06-17T01:37:50+00:00

i`m having troubles with the function each, i want to load a highcharts in

  • 0

i`m having troubles with the function each, i want to load a highcharts in different divs with the same name, with an ajax function so it reloads.

I was reading an old post where the chart was loaded this way:

$('.portlet_content_18').each(function(){
var chart = new Highcharts.Chart({
    chart: {
        renderTo: this,
        height: 400
    },
    xAxis: {
        categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
    },

    series: [{
        data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]        
    }]
});
}));

Thing that work for me but not when i change to the ajax call.

My code working with the ajax call, only loading in the first div with the name “graphcontainer” is the next:

function graph() {
    $(function () {

        $.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&callback=?', function (data) {
            // Create the chart
            window.chart = new Highcharts.StockChart({
                chart: {
                    renderTo: 'graphcontainer'
                },
                rangeSelector: {
                    selected: 1
                },

                title: {
                    text: 'AAPL Stock Price'
                },

                series: [{
                    name: 'AAPL',
                    data: data,
                    tooltip: {
                        valueDecimals: 2
                    }
                }]
            });
        });
    });
}

I tried to add the each function so it loads in the other divs with no results.
Hope you can help me.

  • 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-06-17T01:37:51+00:00Added an answer on June 17, 2026 at 1:37 am

    According to HighChart API and HighStock API:

    renderTo: String|Object
    The HTML element where the chart will be rendered. 
    If it is a string, the element by that id is used. 
    The HTML element can also be passed by direct reference. Defaults to null.
    

    First, Highchart requires passing "id" of div element. So, I doubt how passing class name works with first example you have mentioned.

    Can you please share from where did you get the former HighChart example ?

    Second, Do you have a div containing id="graphcontainer" and included Highstock like

    <script src="http://code.highcharts.com/stock/highstock.js"></script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having troubles with jQuery's load function and am hoping for some help.
Having trouble with each function... Will try to explain by example... In my code,
I'm having a bit of trouble iterating and retrieving width() values. $(.MyClass).each( function ()
I'm having troubles with a syntax error when trying to create a function in
I'm having trouble replacing a function from a different module with another function and
I'm having trouble fetching the index of another field from jquery .each() function. I
I want to use the .each and .attr function to get div ids. I
i'm having trouble trying to define this function-like macro, which takes 4 vector magnitudes
I'm having trouble trying to use a function in a javascript file I've included
I'm having trouble creating a global function accessible from within all classes. I receive

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.