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

mapd3

Package Overview
Dependencies
Maintainers
6
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mapd3 - npm Package Compare versions

Comparing version 0.12.2 to 0.13.0

.npmignore

2

package.json
{
"name": "mapd3",
"version": "0.12.2",
"version": "0.13.0",
"description": "A fast chart library for the fastest DB",

@@ -5,0 +5,0 @@ "main": "dist/mapd3.js",

@@ -90,3 +90,2 @@ import * as d3 from "./helpers/d3-service"

if (config.extractType) {
console.log("extract")
const formatter = getExtractFormatter(config.extractType)

@@ -93,0 +92,0 @@ cache.xAxis.tickFormat(formatter)

@@ -15,3 +15,4 @@ import {keys} from "./helpers/constants"

height: 500,
chartType: null
chartType: null,
barSpacingPercent: 10
}

@@ -41,2 +42,4 @@

const MIN_BAR_HEIGHT = 1
const getColor = (d) => scales.colorScale(d[keys.ID])

@@ -57,4 +60,2 @@

const stack = data.stack(data.stackData)
const MIN_BAR_HEIGHT = 1
const GUTTER_WIDTH_DIVIDER = 10

@@ -72,3 +73,3 @@ let barData = []

const barW = groupW
const gutterW = groupW / GUTTER_WIDTH_DIVIDER
const gutterW = groupW / 100 * config.barSpacingPercent
const groupedBarW = groupMemberCount ? ((groupW - gutterW) / groupMemberCount) : 0

@@ -115,3 +116,3 @@

} else {
return Math.max(scales.y2Scale(d[keys.VALUE]), cache.chartHeight - MIN_BAR_HEIGHT)
return Math.min(scales.y2Scale(d[keys.VALUE]), cache.chartHeight - MIN_BAR_HEIGHT)
}

@@ -142,2 +143,3 @@ })

const barW = cache.chartWidth / stack[0].length
const gutterW = barW / 100 * config.barSpacingPercent

@@ -164,6 +166,6 @@ const stackedBarGroups = cache.root.selectAll(".bar-group")

.merge(stackedBars)
.attr("x", (d) => scales.xScale(d.data[keys.KEY])- barW / 2)
.attr("x", (d) => scales.xScale(d.data[keys.KEY])- barW / 2 + gutterW / 2)
.attr("y", (d) => scales.yScale(d[1]) )
.attr("height", (d) => scales.yScale(d[0]) - scales.yScale(d[1]))
.attr("width", barW)
.attr("height", (d) => Math.max(scales.yScale(d[0]) - scales.yScale(d[1]), MIN_BAR_HEIGHT))
.attr("width", barW - gutterW)

@@ -170,0 +172,0 @@ stackedBars.exit().remove()

@@ -54,14 +54,6 @@ import * as d3 from "./helpers/d3-service"

.text(config.autoLabel)
cache.binningItems = cache.root.selectAll(".toggleExclusive")
.data(config.binningToggles)
.enter().append("div")
.attr("class", (d) => `item item-${d} toggleExclusive`)
.on("click.select", function click (d) {
const isSelected = this.classList.contains("selected")
dispatcher.call("change", this, {name: d, isSelected})
})
.text((d) => d)
}
setBinningToggles(config.binningToggles)
const LINE_HEIGHT = 20

@@ -76,2 +68,18 @@ cache.root

function setBinningToggles (_binningToggles) {
cache.binningItems = cache.root.selectAll(".toggleExclusive")
.data(_binningToggles)
cache.binningItems.enter().append("div")
.attr("class", (d) => `item item-${d} toggleExclusive`)
.on("click.select", function click (d) {
const isSelected = this.classList.contains("selected")
dispatcher.call("change", this, {name: d, isSelected})
})
.merge(cache.binningItems)
.text((d) => d)
cache.binningItems.exit().remove()
}
function changeBinning (_selectedItemName) {

@@ -78,0 +86,0 @@ if (_selectedItemName) {

import * as d3 from "./helpers/d3-service"
import {override, stringToType, getSizes} from "./helpers/common"
import {override, stringToType, getSizes, extendIsValid} from "./helpers/common"
import {blurOnEnter} from "./interactors"

@@ -82,16 +82,22 @@

const domain = scales.xScale.domain()
let rangeMin = config.brushRangeMin === null ? domain[0] : config.brushRangeMin
let rangeMax = config.brushRangeMax === null ? domain[1] : config.brushRangeMax
if (config.keyType === "time") {
const format = d3.utcFormat(config.dateFormat)
rangeMin = format(new Date(rangeMin))
rangeMax = format(new Date(rangeMax))
if (extendIsValid(domain)) {
let rangeMin = config.brushRangeMin === null ? domain[0] : config.brushRangeMin
let rangeMax = config.brushRangeMax === null ? domain[1] : config.brushRangeMax
if (config.keyType === "time") {
const format = d3.utcFormat(config.dateFormat)
rangeMin = format(new Date(rangeMin))
rangeMax = format(new Date(rangeMax))
} else {
const format = d3.format(config.numberFormat)
rangeMin = format(rangeMin)
rangeMax = format(rangeMax)
}
cache.inputMin.text(rangeMin)
cache.inputMax.text(rangeMax)
} else {
const format = d3.format(config.numberFormat)
rangeMin = format(rangeMin)
rangeMax = format(rangeMax)
cache.inputMin.text("")
cache.inputMax.text("")
}
cache.inputMin.text(rangeMin)
cache.inputMax.text(rangeMax)
}

@@ -98,0 +104,0 @@

import * as d3 from "./helpers/d3-service"
import {invertScale, override, getSizes} from "./helpers/common"
import {invertScale, override, getSizes, extendIsValid} from "./helpers/common"

@@ -93,6 +93,2 @@ export default function Brush (_container) {

function extendIsValid (extent) {
return extent && extent.length && extent.filter(d => !isNaN(d) && typeof d !== "undefined" && d !== null).length == 2
}
function moveBrush () {

@@ -99,0 +95,0 @@ const dataExtent = scales.xScale.domain()

@@ -112,3 +112,6 @@ import * as d3 from "./helpers/d3-service"

yLabel: "",
y2Label: ""
y2Label: "",
// bar
barSpacingPercent: 10
}

@@ -115,0 +118,0 @@

@@ -108,1 +108,14 @@ import {keys} from "./constants"

}
export function isNumeric (val) {
return Number(parseFloat(val)) === val;
}
export function extendIsValid (extent) {
return extent
&& extent.length
&& extent.filter(d => !isNaN(d.valueOf()) // valueOf also catches Invalid Date
&& typeof d !== "undefined"
&& d !== null
).length == 2
}
import * as d3 from "./helpers/d3-service"
import {keys, dashStylesTranslation} from "./helpers/constants"
import {cloneData, override} from "./helpers/common"
import {cloneData, isNumeric, override} from "./helpers/common"
import {binTranslation, formatOddDateBin, multiFormat, formatTooltipNumber} from "./helpers/formatters"

@@ -23,4 +23,2 @@

tooltipTitle: null,
// from chart
binningResolution: null,

@@ -241,3 +239,3 @@ binningIsAuto: null,

}
} else if (!isNaN(title)) {
} else if (isNumeric(title)) {
title = formatTooltipNumber(title)

@@ -244,0 +242,0 @@ }

Sorry, the diff of this file is not supported yet

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