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

mapd3

Package Overview
Dependencies
Maintainers
1
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.1.0 to 0.2.0

examples/examples.js

4

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

@@ -14,3 +14,3 @@ "main": "dist/mapd3.js",

"styles": "grunt lint && grunt sass && grunt cssmin",
"docs": "webpack --mode=demos && npm run styles && grunt docs",
"docs": "documentation build -f \"html\" examples/examples.js -o doc",
"prod": "webpack --mode=prod --watch",

@@ -17,0 +17,0 @@ "dev": "webpack --mode=dev --watch",

@@ -5,3 +5,5 @@ import Line from "./charts/line.js"

import Observer from "./charts/observer.js"
import Binning from "./charts/binning.js"
import Brush from "./charts/brush.js"
import Interactors from "./charts/interactors.js"
import {colors} from "./charts/helpers/colors.js"

@@ -14,4 +16,6 @@

Observer,
Binning,
Brush,
Interactors,
colors
}

@@ -7,3 +7,3 @@ import {extent, sum, bisector} from "d3-array"

import {scaleTime, scalePoint, scaleLinear, scaleOrdinal} from "d3-scale"
import {area, line, stack} from "d3-shape"
import {area, curveCatmullRom, line, stack, stackOffsetNone, stackOrderNone} from "d3-shape"
import {select, mouse} from "d3-selection"

@@ -36,3 +36,3 @@ import {timeFormat} from "d3-time-format"

tickPadding: 5,
colorSchema: colors.mapdColors,
colorSchema: colors.mapdColors.map((d) => ({value: d})),
dotRadius: 4,

@@ -42,2 +42,3 @@ xAxisFormat: "%c",

tickSizes: 8,
defaultColor: "skyblue",

@@ -73,3 +74,2 @@ isAnimated: false,

xScale: null, yScale: null, yScale2: null, colorScale: null,
seriesColorScale: null,
xAxis: null, yAxis: null, yAxis2: null,

@@ -117,23 +117,21 @@ groupKeys: [],

if (!cache.svg) {
const template = `<svg class="mapd3 line-chart">
<g class="container-group">
<g class="grid-lines-group"></g>
<g class="x-axis-group">
<g class="axis x"></g>
</g>
<g class="y-axis-group axis y"></g>
<g class="y-axis-group2 axis y"></g>
<g class="chart-group"></g>
<g class="metadata-group">
<g class="hover-marker vertical-marker-container"></g>
</g>
</g>
<rect class="masking-rectangle"></rect>
</svg>`
cache.svg = select(cache.container)
.append("svg")
.classed("mapd3 line-chart", true)
const container = cache.svg.append("g")
.classed("container-group", true)
container.append("g").classed("grid-lines-group", true)
container.append("g").classed("x-axis-group", true)
.append("g").classed("axis x", true)
container.append("g").classed("y-axis-group axis y", true)
container.append("g").classed("y-axis-group2 axis y", true)
container.append("g").classed("chart-group", true)
const metadataGroup = container.append("g")
.classed("metadata-group", true)
metadataGroup.append("g")
.attr("class", "hover-marker vertical-marker-container")
cache.maskingRectangle = cache.svg.append("rect")
.attr("class", "masking-rectangle")
.html(template)
.select("svg")
}

@@ -261,12 +259,8 @@

function buildColorScale () {
const ids = cache.dataBySeries.map(getID)
cache.colorScale = scaleOrdinal()
.range(config.colorSchema)
.domain(cache.dataBySeries.map(getID))
const range = cache.colorScale.range()
cache.seriesColorScale = cache.colorScale.domain()
.reduce((memo, item, i) => {
memo[item] = range[i]
return memo
}, {})
.range(config.colorSchema.map((d) => d.value))
.domain(config.colorSchema.map((d, i) => d.key || ids[i]))
.unknown(config.defaultColor)
console.log(111, cache.colorScale.range(), cache.colorScale.domain(), ids, config.colorSchema)
}

@@ -319,4 +313,4 @@

.keys(cache.dataBySeries.map(getID))
.order(d3.stackOrderNone)
.offset(d3.stackOffsetNone)
.order(stackOrderNone)
.offset(stackOffsetNone)

@@ -390,3 +384,3 @@ const valuesExtent = extent(allStackHeights)

.y((d) => cache.yScale2(d[keys.VALUE]))
.curve(d3.curveCatmullRom)
.curve(curveCatmullRom)

@@ -407,3 +401,4 @@ const lines = cache.svg.select(".chart-group").selectAll(".mark")

})
.style("stroke", getColor)
.style("stroke", (d) => cache.colorScale(d[keys.ID]))
// .style("stroke", getColor)
.style("fill", "none")

@@ -424,3 +419,3 @@

.y1(() => cache.chartHeight)
.curve(d3.curveCatmullRom)
.curve(curveCatmullRom)

@@ -624,3 +619,3 @@ const areas = cache.svg.select(".chart-group").selectAll(".mark")

}
dispatcher.call("mouseMove", _e, dataPoint, cache.seriesColorScale, dataPointXPosition)
dispatcher.call("mouseMove", _e, dataPoint, dataPointXPosition)
}

@@ -643,3 +638,3 @@ }

}
cache.verticalMarkerContainer.style("display", "block")

@@ -646,0 +641,0 @@

@@ -150,3 +150,3 @@ import {easeQuadInOut} from "d3-ease"

.attr("r", config.dotRadius)
.style("fill", (d) => chartCache.seriesColorScale[d[keys.ID]])
.style("fill", (d) => chartCache.colorScale(d[keys.ID]))
tooltipCircles.exit().remove()

@@ -239,3 +239,3 @@

function update (_dataPoint, _colorMapping, _xPosition, _yPosition = null) {
function update (_dataPoint, _xPosition, _yPosition = null) {
updateTooltip(_dataPoint, _xPosition, _yPosition)

@@ -242,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