Socket
Socket
Sign inDemoInstall

@jiaminghi/charts

Package Overview
Dependencies
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jiaminghi/charts - npm Package Compare versions

Comparing version 0.2.15 to 0.2.16

6

CHANGELOG.md

@@ -0,1 +1,7 @@

# 0.2.16-alpha (2020-06-16)
### Perfect
- **numberText:** Add number formatter.
# 0.2.15-alpha (2020-05-06)

@@ -2,0 +8,0 @@

20

lib/extend/index.js

@@ -149,3 +149,5 @@ "use strict";

position: [0, 0],
toFixed: 0
toFixed: 0,
rowGap: 0,
formatter: null
},

@@ -171,10 +173,14 @@ validator: function validator(_ref7) {

toFixed = shape.toFixed,
rowGap = shape.rowGap;
rowGap = shape.rowGap,
formatter = shape.formatter;
var textSegments = content.split('{nt}');
var lastSegmentIndex = textSegments.length - 1;
var textString = '';
textSegments.forEach(function (t, i) {
var currentNumber = number[i];
if (i === lastSegmentIndex) currentNumber = '';
if (typeof currentNumber === 'number') currentNumber = currentNumber.toFixed(toFixed);
var currentNumber = number[i] || '';
if (typeof currentNumber === 'number') {
currentNumber = currentNumber.toFixed(toFixed);
if (typeof formatter === 'function') currentNumber = formatter(currentNumber);
}
textString += t + (currentNumber || '');

@@ -188,3 +194,3 @@ });

content: textString,
rowGap: rowGap || 0
rowGap: rowGap
})

@@ -191,0 +197,0 @@ });

{
"name": "@jiaminghi/charts",
"version": "0.2.15",
"version": "0.2.16",
"author": "JiaMing <743192023@qq.com>",

@@ -5,0 +5,0 @@ "description": "Lightweight charting",

@@ -138,3 +138,5 @@ import { extendNewGraph } from '@jiaminghi/c-render'

position: [0, 0],
toFixed: 0
toFixed: 0,
rowGap: 0,
formatter: null
},

@@ -156,16 +158,16 @@

draw ({ ctx }, { shape }) {
const { number, content, toFixed, rowGap } = shape
const { number, content, toFixed, rowGap, formatter } = shape
const textSegments = content.split('{nt}')
const lastSegmentIndex = textSegments.length - 1
let textString = ''
textSegments.forEach((t, i) => {
let currentNumber = number[i]
let currentNumber = number[i] || ''
if (i === lastSegmentIndex) currentNumber = ''
if (typeof currentNumber === 'number') {
currentNumber = currentNumber.toFixed(toFixed)
if (typeof currentNumber === 'number') currentNumber = currentNumber.toFixed(toFixed)
if (typeof formatter === 'function') currentNumber = formatter(currentNumber)
}

@@ -175,3 +177,3 @@ textString += t + (currentNumber || '')

text.draw({ ctx }, { shape: { ...shape, content: textString, rowGap: rowGap || 0 } })
text.draw({ ctx }, { shape: { ...shape, content: textString, rowGap } })
}

@@ -178,0 +180,0 @@ }

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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