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

d2-charts-api

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d2-charts-api - npm Package Compare versions

Comparing version 32.0.0 to 32.0.1

19

lib/config/adapters/dhis_highcharts/seriesItems.js

@@ -12,3 +12,7 @@ 'use strict';

exports.hasExtraAxis = hasExtraAxis;
exports.hasExtraAxisItems = hasExtraAxisItems;
exports.getAxisIdsMap = getAxisIdsMap;
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var SERIES_ITEM_SERIES = exports.SERIES_ITEM_SERIES = 'series';

@@ -47,2 +51,17 @@ var SERIES_ITEM_AXIS = exports.SERIES_ITEM_AXIS = 'axis';

// returns: true or false
function hasExtraAxisItems(seriesItems, columns) {
var axisIds = Object.keys(getIdAxisMap(seriesItems));
var seriesIds = columns.reduce(function (all, dim) {
all.push.apply(all, _toConsumableArray(dim.items.map(function (item) {
return item.id;
})));
return all;
}, []);
return axisIds.find(function (id) {
return seriesIds.includes(id);
});
}
// returns:

@@ -49,0 +68,0 @@ // {

2

lib/config/adapters/dhis_highcharts/yAxis/index.js

@@ -116,3 +116,3 @@ 'use strict';

if ((0, _type.isDualAxis)(layout.type) && (0, _seriesItems.hasExtraAxis)(layout.seriesItems)) {
if ((0, _type.isDualAxis)(layout.type) && (0, _seriesItems.hasExtraAxis)(layout.seriesItems) && (0, _seriesItems.hasExtraAxisItems)(layout.seriesItems, layout.columns)) {
axes.push({

@@ -119,0 +119,0 @@ title: {

{
"name": "d2-charts-api",
"version": "32.0.0",
"version": "32.0.1",
"description": "DHIS2 charts api",

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

@@ -34,2 +34,13 @@ export const SERIES_ITEM_SERIES = 'series';

// returns: true or false
export function hasExtraAxisItems(seriesItems, columns) {
const axisIds = Object.keys(getIdAxisMap(seriesItems))
const seriesIds = columns.reduce((all, dim) => {
all.push(...(dim.items.map(item => item.id)));
return all;
}, []);
return axisIds.find(id => seriesIds.includes(id));
}
// returns:

@@ -36,0 +47,0 @@ // {

@@ -9,3 +9,3 @@ import arrayClean from 'd2-utilizr/lib/arrayClean';

import { getIsStacked } from '../type';
import { hasExtraAxis } from '../seriesItems';
import { hasExtraAxis, hasExtraAxisItems } from '../seriesItems';

@@ -91,3 +91,5 @@ const DEFAULT_MIN_VALUE = 0;

if (isDualAxis(layout.type) && hasExtraAxis(layout.seriesItems)) {
if (isDualAxis(layout.type) &&
hasExtraAxis(layout.seriesItems) &&
hasExtraAxisItems(layout.seriesItems, layout.columns)) {
axes.push({

@@ -94,0 +96,0 @@ title: {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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