Return value from dataPointSelection event in ApexchartsHow to implement click event or data point selection on apexCharts?VueJS - how component gets global data item?How to remove Vuejs "scope is undefined' warning?Laravel event not being BroadcastVuex: passing state property via propscomputed nested property VuejsVueJs Nested props coming through undefinedVue component data property not updating after parent data changesComponent's props return null when called upon in childVue.js with vue-chartjs - pulling data from APIVue - passing params to route as props is undefined

How to avoid using System.String with Rfc2898DeriveBytes in C#

Can others monetize my project with GPLv3?

What is the hex versus octal timeline?

Is it appropriate for a prospective landlord to ask me for my credit report?

Why is Boris Johnson visiting only Paris & Berlin if every member of the EU needs to agree on a withdrawal deal?

What's that rattling noise from parked jets?

Why didn’t Doctor Strange stay in the original winning timeline?

Ask for a paid taxi in order to arrive as early as possible for an interview within the city

Do I have to learn /o/ or /ɔ/ separately?

Why would the US President need briefings on UFOs?

Why were movies shot on film shot at 24 frames per second?

Repetitive validation of Console inputs

Why doesn't mathematics collapse even though humans quite often make mistakes in their proofs?

Avoiding racist tropes in fantasy

How big would a Daddy Longlegs Spider need to be to kill an average Human?

Why are isotropic tensors not considered scalars?

The teacher logged me in as administrator for doing a short task, is the whole system now compromised?

Is a butterfly one or two animals?

Church Booleans

(Why) May a Beit Din refuse to bury a body in order to coerce a man into giving a divorce?

To "hit home" in German

Why doesn't the Falcon-9 first stage use three legs to land?

Why don't politicians push for fossil fuel reduction by pointing out their scarcity?

Why my earth simulation is slower than the reality?



Return value from dataPointSelection event in Apexcharts


How to implement click event or data point selection on apexCharts?VueJS - how component gets global data item?How to remove Vuejs "scope is undefined' warning?Laravel event not being BroadcastVuex: passing state property via propscomputed nested property VuejsVueJs Nested props coming through undefinedVue component data property not updating after parent data changesComponent's props return null when called upon in childVue.js with vue-chartjs - pulling data from APIVue - passing params to route as props is undefined






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















I have a question related to this question and this answer but they don't solve my question completely. I'm using vue and apexcharts and I would like to return a value or update a variable from an event. Is it possible to return something instead of printing it in the console?



Something like this:



 events: 
dataPointSelection: function (event, chartContext, config)
this.active = this.series[config.seriesIndex];




The problem that I face is that "this" makes reference to the overall vue component and therefore "series" and "active" cannot be found.



Here is the code that gives me"TypeError: this.series is undefined" when I click on a point data. The series data I get from the parent component and it looks like this:



["name":"S-1","data":[[2.65,100], [6.67,100]], "name":"S-2","data":[[0,50],[2.65,50]]]


<script>
import VueApexCharts from 'vue-apexcharts';

export default
name: "myGraph",
components:
apexchart: VueApexCharts,
,
props:
series:
,
data: () => (
active: undefined,
chartOptions:
chart:
width: '100%',
animations:
enabled: false
,
events:
dataPointSelection: function (event, chartContext, config)
this.active = this.series[config.seriesIndex];


,
tooltip:
intersect: true,
shared: false
,
markers: size: 1,

),

}
</script>


The idea is that on dataPointSelection, it should activate that serie in order to access later on other information that will be store in that object.










share|improve this question






























    2















    I have a question related to this question and this answer but they don't solve my question completely. I'm using vue and apexcharts and I would like to return a value or update a variable from an event. Is it possible to return something instead of printing it in the console?



    Something like this:



     events: 
    dataPointSelection: function (event, chartContext, config)
    this.active = this.series[config.seriesIndex];




    The problem that I face is that "this" makes reference to the overall vue component and therefore "series" and "active" cannot be found.



    Here is the code that gives me"TypeError: this.series is undefined" when I click on a point data. The series data I get from the parent component and it looks like this:



    ["name":"S-1","data":[[2.65,100], [6.67,100]], "name":"S-2","data":[[0,50],[2.65,50]]]


    <script>
    import VueApexCharts from 'vue-apexcharts';

    export default
    name: "myGraph",
    components:
    apexchart: VueApexCharts,
    ,
    props:
    series:
    ,
    data: () => (
    active: undefined,
    chartOptions:
    chart:
    width: '100%',
    animations:
    enabled: false
    ,
    events:
    dataPointSelection: function (event, chartContext, config)
    this.active = this.series[config.seriesIndex];


    ,
    tooltip:
    intersect: true,
    shared: false
    ,
    markers: size: 1,

    ),

    }
    </script>


    The idea is that on dataPointSelection, it should activate that serie in order to access later on other information that will be store in that object.










    share|improve this question


























      2












      2








      2








      I have a question related to this question and this answer but they don't solve my question completely. I'm using vue and apexcharts and I would like to return a value or update a variable from an event. Is it possible to return something instead of printing it in the console?



      Something like this:



       events: 
      dataPointSelection: function (event, chartContext, config)
      this.active = this.series[config.seriesIndex];




      The problem that I face is that "this" makes reference to the overall vue component and therefore "series" and "active" cannot be found.



      Here is the code that gives me"TypeError: this.series is undefined" when I click on a point data. The series data I get from the parent component and it looks like this:



      ["name":"S-1","data":[[2.65,100], [6.67,100]], "name":"S-2","data":[[0,50],[2.65,50]]]


      <script>
      import VueApexCharts from 'vue-apexcharts';

      export default
      name: "myGraph",
      components:
      apexchart: VueApexCharts,
      ,
      props:
      series:
      ,
      data: () => (
      active: undefined,
      chartOptions:
      chart:
      width: '100%',
      animations:
      enabled: false
      ,
      events:
      dataPointSelection: function (event, chartContext, config)
      this.active = this.series[config.seriesIndex];


      ,
      tooltip:
      intersect: true,
      shared: false
      ,
      markers: size: 1,

      ),

      }
      </script>


      The idea is that on dataPointSelection, it should activate that serie in order to access later on other information that will be store in that object.










      share|improve this question














      I have a question related to this question and this answer but they don't solve my question completely. I'm using vue and apexcharts and I would like to return a value or update a variable from an event. Is it possible to return something instead of printing it in the console?



      Something like this:



       events: 
      dataPointSelection: function (event, chartContext, config)
      this.active = this.series[config.seriesIndex];




      The problem that I face is that "this" makes reference to the overall vue component and therefore "series" and "active" cannot be found.



      Here is the code that gives me"TypeError: this.series is undefined" when I click on a point data. The series data I get from the parent component and it looks like this:



      ["name":"S-1","data":[[2.65,100], [6.67,100]], "name":"S-2","data":[[0,50],[2.65,50]]]


      <script>
      import VueApexCharts from 'vue-apexcharts';

      export default
      name: "myGraph",
      components:
      apexchart: VueApexCharts,
      ,
      props:
      series:
      ,
      data: () => (
      active: undefined,
      chartOptions:
      chart:
      width: '100%',
      animations:
      enabled: false
      ,
      events:
      dataPointSelection: function (event, chartContext, config)
      this.active = this.series[config.seriesIndex];


      ,
      tooltip:
      intersect: true,
      shared: false
      ,
      markers: size: 1,

      ),

      }
      </script>


      The idea is that on dataPointSelection, it should activate that serie in order to access later on other information that will be store in that object.







      vue.js apexcharts






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 27 at 15:05









      HermiHermi

      135 bronze badges




      135 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          1














          The easiest way is to bind the event directly in the component



          <apexchart type="bar" @dataPointSelection="dataPointSelectionHandler"></apexchart>

          methods:
          dataPointSelectionHandler(e, chartContext, config)
          console.log(chartContext, config)




          Another way is to use ES6 arrow functions in your chart configuration



          computed: 
          chartOptions: function()
          return
          chart:
          events:
          dataPointSelection: (e, chart, opts) =>
          // you can call Vue methods now as "this" will point to the Vue instance when you use ES6 arrow function
          this.VueDemoMethod();


          ,








          share|improve this answer
























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55380444%2freturn-value-from-datapointselection-event-in-apexcharts%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            The easiest way is to bind the event directly in the component



            <apexchart type="bar" @dataPointSelection="dataPointSelectionHandler"></apexchart>

            methods:
            dataPointSelectionHandler(e, chartContext, config)
            console.log(chartContext, config)




            Another way is to use ES6 arrow functions in your chart configuration



            computed: 
            chartOptions: function()
            return
            chart:
            events:
            dataPointSelection: (e, chart, opts) =>
            // you can call Vue methods now as "this" will point to the Vue instance when you use ES6 arrow function
            this.VueDemoMethod();


            ,








            share|improve this answer





























              1














              The easiest way is to bind the event directly in the component



              <apexchart type="bar" @dataPointSelection="dataPointSelectionHandler"></apexchart>

              methods:
              dataPointSelectionHandler(e, chartContext, config)
              console.log(chartContext, config)




              Another way is to use ES6 arrow functions in your chart configuration



              computed: 
              chartOptions: function()
              return
              chart:
              events:
              dataPointSelection: (e, chart, opts) =>
              // you can call Vue methods now as "this" will point to the Vue instance when you use ES6 arrow function
              this.VueDemoMethod();


              ,








              share|improve this answer



























                1












                1








                1







                The easiest way is to bind the event directly in the component



                <apexchart type="bar" @dataPointSelection="dataPointSelectionHandler"></apexchart>

                methods:
                dataPointSelectionHandler(e, chartContext, config)
                console.log(chartContext, config)




                Another way is to use ES6 arrow functions in your chart configuration



                computed: 
                chartOptions: function()
                return
                chart:
                events:
                dataPointSelection: (e, chart, opts) =>
                // you can call Vue methods now as "this" will point to the Vue instance when you use ES6 arrow function
                this.VueDemoMethod();


                ,








                share|improve this answer













                The easiest way is to bind the event directly in the component



                <apexchart type="bar" @dataPointSelection="dataPointSelectionHandler"></apexchart>

                methods:
                dataPointSelectionHandler(e, chartContext, config)
                console.log(chartContext, config)




                Another way is to use ES6 arrow functions in your chart configuration



                computed: 
                chartOptions: function()
                return
                chart:
                events:
                dataPointSelection: (e, chart, opts) =>
                // you can call Vue methods now as "this" will point to the Vue instance when you use ES6 arrow function
                this.VueDemoMethod();


                ,









                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 27 at 18:15









                junedchhipajunedchhipa

                5096 silver badges12 bronze badges




                5096 silver badges12 bronze badges





















                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55380444%2freturn-value-from-datapointselection-event-in-apexcharts%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript