-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Gauge charts #18
Comments
Glad you like it! How are you importing highcharts-more into your code? It should be something like import Highcharts from 'highcharts';
require('highcharts/highcharts-more')(Highcharts); |
Yeah that was my approach. Apologies, should have clarified in my initial question that I'm receiving an error that the type of series is unsupported (solidgauge)
This is with Chart prop type = solidgauge and Series type = solidgauge. |
Ah you also need the So... (I think) import Highcharts from 'highcharts';
require('highcharts/highcharts-more')(Highcharts);
require('highcharts/modules/solid-gauge')(Highcharts); |
Running into an issue with the hard coded values for expected chart and series types.
|
Ah, I haven't added support for gauges yet, but maybe that prop type validation is too restrictive. Does it work despite the warning? |
It doesn't. Seems like it fails to generate the yAxis.
|
Would you be able to paste the code you're seeing this error with? I was hoping it would work similar to the Funnel example, which has no axes. https://whawker.github.io/react-jsx-highcharts/examples/Funnel/index.html |
P.s. just pushed a commit which removes the prop type validation for series type |
Thanks for the update. I'm not seeing the errors anymore though it still is not rendering the gauge. In all examples I've seen of the solid-gauge it utilizes a pane object to set up the tracks for the gauge. Are props passed down through the HighchartsChart component? `import React from 'react'; import Highcharts from 'highcharts'; import { require('highcharts/highcharts-more')(Highcharts); const CubeChart = props => {
}; export default CubeChart;` |
So this isn't your code, but it's an example of a Gauge chart, it's a little hacky though as I've never really tried to properly support it. It might give you something to work from though? A few notes
import React, { Component } from 'react';
import Highcharts from 'highcharts';
import {
HighchartsChart, Series, XAxis, YAxis
} from 'react-jsx-highcharts';
require('highcharts/highcharts-more')(Highcharts);
require('highcharts/modules/solid-gauge')(Highcharts);
class GaugeChart extends Component {
render() {
const plotOptions = {
solidgauge: {
dataLabels: {
y: 5,
borderWidth: 0,
useHTML: true
}
}
};
const paneOptions = {
center: ['50%', '85%'],
size: '140%',
startAngle: -90,
endAngle: 90,
background: {
backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || '#EEE',
innerRadius: '60%',
outerRadius: '100%',
shape: 'arc'
}
};
return (
<div className="app">
<HighchartsChart chart={{ type: 'solidgauge' }} plotOptions={plotOptions} pane={paneOptions}>
<XAxis />
<YAxis
id="myAxis"
min={0}
max={200}
lineWidth={0}
minorTickInterval={null}
tickAmount={2}
labels={{ y: 16 }}>
<Series
id="gauge-test"
name="gauge-test"
data={[80]}
type="solidgauge" />
</YAxis>
</HighchartsChart>
</div>
);
}
}
export default GaugeChart; |
Sweet, this works. Thanks for providing the example! |
Thanks for the work on this, super useful library.
Quick question however, is there support for highcharts-more? I can't seem to get any of the charts provided there working with this.
The text was updated successfully, but these errors were encountered: