Giter VIP home page Giter VIP logo

Comments (18)

ertaj avatar ertaj commented on June 16, 2024 5

annotations not working !
please help me :(

from highcharts-react.

ppotaczek avatar ppotaczek commented on June 16, 2024 4

Hi rohankk2,

There should be no problems with the combination of annotations and react wrapper. Did you include annotations module?

require("highcharts/modules/annotations")(Highcharts);

Live demo: https://codesandbox.io/s/9jxnk5zv2w

from highcharts-react.

rholstad avatar rholstad commented on June 16, 2024 4

@rohankk2

import * as Highcharts from 'highcharts';
import * as AnnotationsModule from 'highcharts/modules/annotations';
AnnotationsModule(Highcharts);

from highcharts-react.

arenddeboer avatar arenddeboer commented on June 16, 2024 1

This worked for me:

import HighchartsReact from "highcharts-react-official"
import Highcharts from "highcharts/highstock"
import HighchartsExporting from "highcharts/modules/exporting"
import AnnotationsModule from "highcharts/modules/annotations"
AnnotationsModule(Highcharts)

from highcharts-react.

rohankk2 avatar rohankk2 commented on June 16, 2024
import React,{Component} from "react";
import Highcharts from 'highcharts';
import HighchartsReact from "highcharts-react-official";
import Table1 from './table.js';

require("highcharts/modules/annotations")(Highcharts);

I added the same imports as above. I am still not seeing the annotations. I can pretty much enable most of the other features of highcharts except annotations.
this is how i am calling the required element in render :
<HighchartsReact highcharts={Highcharts} constructorType={'chart'} options={this.state.options} />

 var options = {
            title: {
                text: 'DATA',
                allowDragX: true,
            },
           legend: {
    enabled: true
  },
            chart: {
                type: 'column'
            },
            xAxis: {
                title: {text: 'Point'},
                categories: body2
            },

            yAxis:
                {
                    title: {
                        text: 'Tp',

                    },


                },
             annotations: [{
        labels: [{
            point: 'max',
            text: 'Max'
        }, {
            point: 'min',
            text: 'Min',
            backgroundColor: 'black'
        }]
    }],
            series:
                {
                    name:'Tp',
                    data:  r ,

                },
            credits:{
                enabled:false
            },



        };

The above is my highcharts code.

from highcharts-react.

rohankk2 avatar rohankk2 commented on June 16, 2024

I tried your exact example. It showed the graph but no annotation loaded!

from highcharts-react.

ppotaczek avatar ppotaczek commented on June 16, 2024

Hi rohankk2,

As you can see in my example annotations works, so probably there is a problem in your project. Without reproducing this issue I will not be able to help you, so please prepare some live example in codesandbox.

Best regards!

from highcharts-react.

justduy avatar justduy commented on June 16, 2024

I also had problems using annotations, so I opted flags instead. Never got those annotations to show

from highcharts-react.

ppotaczek avatar ppotaczek commented on June 16, 2024

@justduy, Could you reproduce your problem with annotations?

from highcharts-react.

rohankk2 avatar rohankk2 commented on June 16, 2024

@ppotaczek I would recommend try loading annotations with data loaded from a server rather than using hardcoded fields. Moreover, I was able to repro the problem only when i had highchartsReact declared inside a component called charts and then called that component charts in the main index.js file. So if you try the above two things, you should see the problem

from highcharts-react.

ppotaczek avatar ppotaczek commented on June 16, 2024

@rohankk2, I reproduced the situation you describe and the annotations still work. Perhaps, you use require("highcharts/modules/annotations")(Highcharts) in wrong place. Could you adapt the example below so that we can show the problem?

Live example with dynamic data and separate component: https://codesandbox.io/s/lpq487joyz

from highcharts-react.

KacperMadej avatar KacperMadej commented on June 16, 2024

Closing due to inactivity.

from highcharts-react.

ashwiniIot avatar ashwiniIot commented on June 16, 2024

annotations not working in react js i am using typescript. installed highchart-annotations still not showing annotations

from highcharts-react.

ppotaczek avatar ppotaczek commented on June 16, 2024

Hello @ashwiniIot, Please reproduce the problem in codesandbox.

from highcharts-react.

JonathanGVC avatar JonathanGVC commented on June 16, 2024

I recreated this here:
https://codesandbox.io/s/highcharts-react-demo-forked-q6ex2?file=/demo.tsx

In my case I can't get any line annotations to show up as shown above.

from highcharts-react.

ppotaczek avatar ppotaczek commented on June 16, 2024

Hi @JonathanGVC,

The problem is not related with highcharts-react, your annotation options are incorrect. Please check the example below.

Live demo: https://codesandbox.io/s/highcharts-react-demo-5uygw?file=/demo.tsx
API Reference: https://api.highcharts.com/highcharts/annotations

from highcharts-react.

JonathanGVC avatar JonathanGVC commented on June 16, 2024

@ppotaczek Can you change the example to generate an infinite line, it's the annotation I specifically need and can't get to work. The example can't be expanded to show that type.

from highcharts-react.

ppotaczek avatar ppotaczek commented on June 16, 2024

It seems that a better choice for you is to use plot lines.

Example: https://codesandbox.io/s/highcharts-react-demo-fork-fpp86?file=/demo.tsx

from highcharts-react.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.