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 7724761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:46:08+00:00 2026-06-01T04:46:08+00:00

i added a method inside my high chart function but im having trouble calling

  • 0

i added a method inside my high chart function but im having trouble calling it.

i think i might have the wrong syntax or may have placed the method in the wrong spot(relatively new to JS). the method is at the bottom of my code,i commented, and is called addPoint.its simply supposed to add a new point to the graph.

i tried troubleshooting with putting an alert in the method but that has yet to work.

heres a jfiddle:
http://jsfiddle.net/fourgates/WdMrm/

here is my code:

NewHighCharts = function() 
    {                       
        chart = new Highcharts.Chart(
        {
            chart : 
            {
                renderTo : 'container',
                type : 'line',
                marginRight : 130,
                marginBottom : 25,
                 events: 
                 {
                    click: function(e) 
                    {
                        // find the clicked values and the series
                        var x = e.xAxis[0].value,
                            y = e.yAxis[0].value,
                            series = this.series[0];
                        // Add it
                        series.addPoint([x, y]);
                    }
                 }
            },

            title : 
            {
                text : 'Body Weight',
                x : -20 //center
            },
            xAxis : 
            {
                categories : ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
            },

            yAxis : 
            {
                title : 
                {
                    text : 'Weight (lbs)'
                },
                plotLines : [{
                    value : 0,
                    width : 1,
                    color : '#808080'
            }]
            },
            tooltip : 
            {
                formatter : function() 
                {
                    return '<b>' + this.series.name + '</b><br/>' + this.x + ': ' + this.y + 'lbs';
                }
            },
            legend : 
            {
                layout : 'vertical',
                align : 'right',
                verticalAlign : 'top',
                x : -10,
                y : 100,
                borderWidth : 0
            },
            series : [{
                name : 'George',
                data : [185,190,185,180]
            }, {
                name : 'Bindu',
                data : [115,110,112,115]
            }]
        });//end of chart
            //this is the method i added
        addPoint = function()
        {
            alert("You Added a point!")
            series = this.series[0];
            series.addPoint([4, 190]);
        };  
    };//end of newHighCharts
    newChart = new NewHighCharts();
    newChart.addPoint();

Thanks in advance for any help!

  • 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-01T04:46:11+00:00Added an answer on June 1, 2026 at 4:46 am

    Here is a fiddle copy of yours with those problems fixed.
    The problems where:

    • The resource load order if you see left on the resource options you’ll see that the exporting.js was loading before the highcharts (simpliy remove it and re add it into the resources and the error of HighCharts is not defined will be solved).
    • Use jQuery instead of Mootools on the panel left where it says framework you can choose it. If you want to use it with mootols you need an adapter.
    • Use this.= on the constructor. If you don’t use this the function/obj will be a global variable instead of a part of the namespace.So replacing the chart= and addPoint= for this.char and this.addPoint.
    • In the add point you should do also a this where you refer to the series. instead of series you should do a this.chart.series.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a model that uses a acts_as_nested_set fork, and I've added a method
I have added the following method in my User Domain class String getNameAttribute(){ return
i have override validate method and added errors using addFieldError(test, test print); and in
I have this method: public bool CanExecute() And after 70 commits, I added an
I'm having some trouble removing an element that gets added dynamically to the DOM.
I have added the onError method to AppModel as follows: class AppModel extends Model
I have a Rails controller where I accidentally defined the 'edit' method inside the
I am newbie in java but I think I have done well teaching myself
I have a method inside one of my classes to my Java application that
I have written a Class with premain method and inside that method I have

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.