Coder Social home page Coder Social logo

Comments (18)

PhilippeOberti avatar PhilippeOberti commented on June 20, 2024 6

so after a long fight I found a way to get it working. here is how (for those that would be in the same situation):

in the vendor.ts file you need to add those 2 lines

import 'highcharts/highcharts-more';
import 'highcharts/modules/solid-gauge';

right after the line where you import highchart (or highstock in my case)

import 'highcharts/highstock';

then in my main.ts file (angular2) I needed to require those 2:

require('highcharts/highcharts-more')(Highcharts);
require('highcharts/modules/solid-gauge')(Highcharts);

in the component ts you want to run the gauge import the CHART_DIRECTIVES as explained in the readme
in the component html use it as follow (no type):

<chart [options]="options"></chart>

I'm having some position issues (I think due to the fact I'm using css flex and hightchart is in relative position) but at least it is displayed with no errors!

hope this helps someone!

from angular2-highcharts.

khraibani avatar khraibani commented on June 20, 2024 1

@dndam thanks for pointing me into the right direction the above didn't work with webpack.

I had to use the below:

declare var require: any;
import { ChartModule } from 'angular2-highcharts';
import * as ChartModuleMore from 'highcharts/highcharts-more';
const HCSoldGauge = require('highcharts/modules/solid-gauge');
import * as Highcharts from "highcharts";
ChartModuleMore(Highcharts);
HCSoldGauge(Highcharts);

Hope that help someone else.

from angular2-highcharts.

PhilippeOberti avatar PhilippeOberti commented on June 20, 2024

so a bit more details, I'm using webpack and I forgot to add highcharts-more and the solid-gauge module in my vendor.ts file.

now my vendor.ts file looks like this

import 'angular2-highcharts/index';
import 'highcharts/highcharts-more';
import 'highcharts/modules/solid-gauge';
import 'highcharts/highstock';
import 'highcharts/modules/map';
import 'highcharts/modules/data';

When I build I can see that the solidgauge type is within my vendor.bundle.js file used by my application.
But when I run the application I get that same error again

error

any idea?
thanks a ton!

from angular2-highcharts.

gevgeny avatar gevgeny commented on June 20, 2024

Did you try to plug modules like it is shown in readme ?

from angular2-highcharts.

PhilippeOberti avatar PhilippeOberti commented on June 20, 2024

OK, I tried to figure out how to import modules from highcharts but I can't find a way to do it. When I look at your explanation in the readme I can't find where the "Highcharts3d: come from. I looked at the highcharts-3d.src.js in the node_modules files and there is nothing there.

Also I can't find a proper syntax to import the highcharts-more and the solid-gauge module.

When I debug the error above inside ChartComponent.js file (line 43) I can go inside the initchart function and find the line where is throws the error:

if (!highchartsService.Highcharts[type]) {
        throw new Error(type + " is unknown chart type.");
}

If I look at the available types inside highchartsService.Highcharts gauge or solidgauge are not there...

Sorry I'm pretty new to this... Could you point me to the right direction?

from angular2-highcharts.

gevgeny avatar gevgeny commented on June 20, 2024

Thanks for investigation.

from angular2-highcharts.

Abhishek-Ravichandran avatar Abhishek-Ravichandran commented on June 20, 2024

Any idea how one would go about importing the solid gauge file when using systemjs? I've tried adding everything in my config file but it does not seem to work at all.

from angular2-highcharts.

witold-gren avatar witold-gren commented on June 20, 2024

systemjs.config.js

var  map = {
   ...
   'angular2-highcharts':        'node_modules/angular2-highcharts',
   'highcharts/highstock.src':   'node_modules/highcharts/highstock.js',
   'highcharts/highcharts-more.js': 'node_modules/highcharts/highcharts-more.js',
   ...
}

#my.component.ts

import {CHART_DIRECTIVES} from 'angular2-highcharts';
import {Highcharts} from 'angular2-highcharts';


require('highcharts/highcharts-more.js')(Highcharts);


@Component({
   ...
})
export class CompareMeasureComponent implements OnInit {
   ...
}

it's work :)

from angular2-highcharts.

alaa-bourouissi avatar alaa-bourouissi commented on June 20, 2024

I have the same problem , but this doesn't solve my problem , I get another problem : Uncaught TypeError: Cannot read property 'arrayMin' of undefined

I think that there is a problemin the highcharts-more.js file , I changed it but the error persist , any suggestions ?

from angular2-highcharts.

maneeshmoota avatar maneeshmoota commented on June 20, 2024

filoucpp, I am also trying to show a "gauge" chart in my angularjs2 (using webpack) project.

I am able to show spline and simple chart without any problem. But gauge chart is not working.

I am getting angular2-highcharts/index has no exported member CHART_DIRECTIVES

could you please share some code snippet?

from angular2-highcharts.

PhilippeOberti avatar PhilippeOberti commented on June 20, 2024

Hi,

the project I am working on has grown quite a lot and we decided to get rid of the angular2-highcharts library and use highcharts directly. This is way easier for us...

Sorry We made that changes a couple of months ago...

from angular2-highcharts.

gevgeny avatar gevgeny commented on June 20, 2024

@maneeshmoota Here is the example of using highcharts module with webpack
https://github.com/gevgeny/angular2-highcharts/blob/master/examples/src/highchartsModuleExample.ts
https://github.com/gevgeny/angular2-highcharts/blob/master/examples/webpack.config.js

from angular2-highcharts.

khraibani avatar khraibani commented on June 20, 2024

Hi, I want to use the Gauge chart, I have tried the above example didn't work for me, I have other charts working, line chart, pie etc I'm using webpack.

could you please share some code snippet?
screen shot 2017-01-04 at 13 09 01

from angular2-highcharts.

dndam avatar dndam commented on June 20, 2024

@khraibani If you have Pie, Line and other charts working, this means that you correctly included HighCharts. Gauge however, is part of the HighChartsMore. To achieve this you need to import this "extra" within your project. It should be something similar with:

import { ChartModule } from 'angular2-highcharts';
import * as ChartModuleMore from 'highcharts/highcharts-more.js';
import HCSoldGauge from 'highcharts/modules/solid-gauge';
import * as Highcharts from "highcharts";
ChartModuleMore(Highcharts);
HCSoldGauge(Highcharts);

You should be focussing on lines 2, 4 and 5 (the above sample is being used within an Ionic2 + Angular 2 app). This is similar with https://github.com/gevgeny/angular2-highcharts/blob/master/examples/src/highchartsModuleExample.ts

from angular2-highcharts.

khraibani avatar khraibani commented on June 20, 2024

@dndam As you have answered my previous question, I wondered if you faced the below issue. (i am trying to get highmaps to work, using webpack) I am getting 'node_modules/angular2-highcharts/index' has no exported CHART_DIRECTIVES

using http://plnkr.co/edit/AmDfKwhRhshFn3CPprkk?p=preview as a reference

screen shot 2017-01-26 at 11 35 24

from angular2-highcharts.

dndam avatar dndam commented on June 20, 2024

Most likely you need to have
import { ChartModule } from 'angular2-highcharts';
on line 4. Error states that angular2-highcharts is no longer exported as CHART_DIRECTIVES. Just (CTRL) click on your import and you should see how highchart is "exported"

If you could share your code, we might be able to help you more.

from angular2-highcharts.

khraibani avatar khraibani commented on June 20, 2024

@dndam Thanks for the response I have created a stub project

https://bitbucket.org/hkhraibani/ng2-highcharts-webpack-demo

from angular2-highcharts.

ermarkar avatar ermarkar commented on June 20, 2024

I am using

import { HighchartsChartModule} from "highcharts-angular";

and gauge chart is not working, any help?

from angular2-highcharts.

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.