Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-icecream-charts

Package Overview
Dependencies
Maintainers
3
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-icecream-charts - npm Package Compare versions

Comparing version 0.10.0 to 0.10.1

21

esm/pie/index.js

@@ -35,25 +35,26 @@ var __assign = (this && this.__assign) || function () {

var langData = useConfig().langData;
var pieOptions = useMemo(function () { return createPieOptions(langData, plotOptions, chartOptions, series); }, [langData, plotOptions, chartOptions, series]);
var callback = useCallback(function (chart) {
var _a, _b;
var handleRedraw = useCallback(function (chart) {
var _a, _b, _c;
// legend 只能相对于整个图表居中, 调整 legend 位置,让 legend 相对 series 居中
var legend = chartOptions === null || chartOptions === void 0 ? void 0 : chartOptions.legend;
if (legend === false || (legend === null || legend === void 0 ? void 0 : legend.align) === undefined || (legend === null || legend === void 0 ? void 0 : legend.align) === 'right-center') {
var updatedLegendOptions = { y: chart.plotTop / 2 };
chart.legend.update(updatedLegendOptions);
if (((_a = chart.options.legend) === null || _a === void 0 ? void 0 : _a.y) !== chart.plotTop / 2) {
var updatedLegendOptions = { y: chart.plotTop / 2 };
chart.legend.update(updatedLegendOptions);
}
}
// 设置内部 title
if (innerTitle) {
(_a = innerTitleRef.current) === null || _a === void 0 ? void 0 : _a.destroy();
(_b = innerTitleRef.current) === null || _b === void 0 ? void 0 : _b.destroy();
innerTitleRef.current = createInnerTitle(chart, innerTitle, !!innerSubtitle);
}
if (innerSubtitle) {
(_b = innerSubtitleRef.current) === null || _b === void 0 ? void 0 : _b.destroy();
(_c = innerSubtitleRef.current) === null || _c === void 0 ? void 0 : _c.destroy();
innerSubtitleRef.current = createInnerSubtitle(chart, innerSubtitle, !!innerTitle);
}
afterRendered === null || afterRendered === void 0 ? void 0 : afterRendered();
}, [chartOptions === null || chartOptions === void 0 ? void 0 : chartOptions.legend, innerTitle, innerSubtitle, afterRendered]);
}, [chartOptions === null || chartOptions === void 0 ? void 0 : chartOptions.legend, innerSubtitle, innerTitle]);
var pieOptions = useMemo(function () { return createPieOptions(langData, plotOptions, chartOptions, series, handleRedraw); }, [langData, plotOptions, chartOptions, series, handleRedraw]);
var ref = useHighOptions(pieOptions, {
chartRef: chartRef,
callback: callback,
callback: afterRendered,
loading: loading,

@@ -60,0 +61,0 @@ langData: langData

@@ -86,2 +86,2 @@ import Highcharts, { CSSObject } from 'highcharts';

}
export declare function createPieOptions(langData: LangData, options?: PlotPieOptions, chartOptions?: ChartPieOptions, series?: SeriesPieOptions[]): Highcharts.Options;
export declare function createPieOptions(langData: LangData, options?: PlotPieOptions, chartOptions?: ChartPieOptions, series?: SeriesPieOptions[], onRedraw?: (chart: Highcharts.Chart) => void): Highcharts.Options;

@@ -27,3 +27,3 @@ var __assign = (this && this.__assign) || function () {

import { createHighOptions, createHighLegendOptions, createHighSeriesOptions, isPointOptionsObject, createHighPointOptions } from '../_chart';
export function createPieOptions(langData, options, chartOptions, series) {
export function createPieOptions(langData, options, chartOptions, series, onRedraw) {
var pieOptions = {

@@ -67,3 +67,6 @@ colors: [

load: wrapRender(chartOptions === null || chartOptions === void 0 ? void 0 : chartOptions.legend),
redraw: wrapRender(chartOptions === null || chartOptions === void 0 ? void 0 : chartOptions.legend)
redraw: function () {
onRedraw === null || onRedraw === void 0 ? void 0 : onRedraw(this);
return wrapRender(chartOptions === null || chartOptions === void 0 ? void 0 : chartOptions.legend);
}
}

@@ -70,0 +73,0 @@ }

@@ -60,25 +60,26 @@ "use strict";

var langData = config_provider_1.useConfig().langData;
var pieOptions = react_1.useMemo(function () { return options_1.createPieOptions(langData, plotOptions, chartOptions, series); }, [langData, plotOptions, chartOptions, series]);
var callback = react_1.useCallback(function (chart) {
var _a, _b;
var handleRedraw = react_1.useCallback(function (chart) {
var _a, _b, _c;
// legend 只能相对于整个图表居中, 调整 legend 位置,让 legend 相对 series 居中
var legend = chartOptions === null || chartOptions === void 0 ? void 0 : chartOptions.legend;
if (legend === false || (legend === null || legend === void 0 ? void 0 : legend.align) === undefined || (legend === null || legend === void 0 ? void 0 : legend.align) === 'right-center') {
var updatedLegendOptions = { y: chart.plotTop / 2 };
chart.legend.update(updatedLegendOptions);
if (((_a = chart.options.legend) === null || _a === void 0 ? void 0 : _a.y) !== chart.plotTop / 2) {
var updatedLegendOptions = { y: chart.plotTop / 2 };
chart.legend.update(updatedLegendOptions);
}
}
// 设置内部 title
if (innerTitle) {
(_a = innerTitleRef.current) === null || _a === void 0 ? void 0 : _a.destroy();
(_b = innerTitleRef.current) === null || _b === void 0 ? void 0 : _b.destroy();
innerTitleRef.current = createInnerTitle(chart, innerTitle, !!innerSubtitle);
}
if (innerSubtitle) {
(_b = innerSubtitleRef.current) === null || _b === void 0 ? void 0 : _b.destroy();
(_c = innerSubtitleRef.current) === null || _c === void 0 ? void 0 : _c.destroy();
innerSubtitleRef.current = createInnerSubtitle(chart, innerSubtitle, !!innerTitle);
}
afterRendered === null || afterRendered === void 0 ? void 0 : afterRendered();
}, [chartOptions === null || chartOptions === void 0 ? void 0 : chartOptions.legend, innerTitle, innerSubtitle, afterRendered]);
}, [chartOptions === null || chartOptions === void 0 ? void 0 : chartOptions.legend, innerSubtitle, innerTitle]);
var pieOptions = react_1.useMemo(function () { return options_1.createPieOptions(langData, plotOptions, chartOptions, series, handleRedraw); }, [langData, plotOptions, chartOptions, series, handleRedraw]);
var ref = _chart_1.useHighOptions(pieOptions, {
chartRef: chartRef,
callback: callback,
callback: afterRendered,
loading: loading,

@@ -85,0 +86,0 @@ langData: langData

@@ -86,2 +86,2 @@ import Highcharts, { CSSObject } from 'highcharts';

}
export declare function createPieOptions(langData: LangData, options?: PlotPieOptions, chartOptions?: ChartPieOptions, series?: SeriesPieOptions[]): Highcharts.Options;
export declare function createPieOptions(langData: LangData, options?: PlotPieOptions, chartOptions?: ChartPieOptions, series?: SeriesPieOptions[], onRedraw?: (chart: Highcharts.Chart) => void): Highcharts.Options;

@@ -33,3 +33,3 @@ "use strict";

var _chart_1 = require("../_chart");
function createPieOptions(langData, options, chartOptions, series) {
function createPieOptions(langData, options, chartOptions, series, onRedraw) {
var pieOptions = {

@@ -73,3 +73,6 @@ colors: [

load: wrapRender(chartOptions === null || chartOptions === void 0 ? void 0 : chartOptions.legend),
redraw: wrapRender(chartOptions === null || chartOptions === void 0 ? void 0 : chartOptions.legend)
redraw: function () {
onRedraw === null || onRedraw === void 0 ? void 0 : onRedraw(this);
return wrapRender(chartOptions === null || chartOptions === void 0 ? void 0 : chartOptions.legend);
}
}

@@ -76,0 +79,0 @@ }

{
"name": "react-icecream-charts",
"version": "0.10.0",
"version": "0.10.1",
"license": "MIT",

@@ -5,0 +5,0 @@ "main": "esm/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc