Comparing version 0.13.0 to 0.13.1
{ | ||
"name": "mapd3", | ||
"version": "0.13.0", | ||
"version": "0.13.1", | ||
"description": "A fast chart library for the fastest DB", | ||
@@ -5,0 +5,0 @@ "main": "dist/mapd3.js", |
@@ -1,2 +0,2 @@ | ||
import {keys} from "./helpers/constants" | ||
import {keys, MAX_MARK_WIDTH} from "./helpers/constants" | ||
import {override, getSizes} from "./helpers/common" | ||
@@ -15,2 +15,3 @@ | ||
height: 500, | ||
chartId: null, | ||
chartType: null, | ||
@@ -70,3 +71,3 @@ barSpacingPercent: 10 | ||
const groupW = groupCount ? (cache.chartWidth / groupCount) : 0 | ||
const barW = groupW | ||
const barW = Math.min(groupW, MAX_MARK_WIDTH) | ||
const gutterW = groupW / 100 * config.barSpacingPercent | ||
@@ -100,3 +101,3 @@ const groupedBarW = groupMemberCount ? ((groupW - gutterW) / groupMemberCount) : 0 | ||
.attr("class", "mark bar") | ||
.attr('clip-path', 'url(#mark-clip)') | ||
.attr('clip-path', `url(#mark-clip-${config.chartId})`) | ||
.merge(bars) | ||
@@ -140,3 +141,3 @@ .attr("x", (d, i) => { | ||
const stack = data.stack(data.stackData) | ||
const barW = cache.chartWidth / stack[0].length | ||
const barW = Math.min(cache.chartWidth / stack[0].length, MAX_MARK_WIDTH) | ||
const gutterW = barW / 100 * config.barSpacingPercent | ||
@@ -162,3 +163,3 @@ | ||
.attr("class", "mark bar") | ||
.attr('clip-path', 'url(#mark-clip)') | ||
.attr('clip-path', `url(#mark-clip-${config.chartId})`) | ||
.merge(stackedBars) | ||
@@ -165,0 +166,0 @@ .attr("x", (d) => scales.xScale(d.data[keys.KEY])- barW / 2 + gutterW / 2) |
@@ -5,3 +5,10 @@ import * as d3 from "./helpers/d3-service" | ||
import {keys} from "./helpers/constants" | ||
import {cloneData, override, throttle, rebind, getSizes} from "./helpers/common" | ||
import { | ||
cloneData, | ||
override, | ||
throttle, | ||
rebind, | ||
getSizes, | ||
uniqueId | ||
} from "./helpers/common" | ||
@@ -36,2 +43,3 @@ import Scale from "./scale" | ||
keyType: "time", | ||
chartId: uniqueId(), | ||
chartType: "line", // line, area, stackedLine, stackedArea | ||
@@ -116,3 +124,3 @@ extractType: null, // isodow, month, quarter, hour, minute | ||
// bar | ||
// bar | ||
barSpacingPercent: 10 | ||
@@ -119,0 +127,0 @@ } |
@@ -18,3 +18,4 @@ import * as d3 from "./helpers/d3-service" | ||
width: 800, | ||
height: 500 | ||
height: 500, | ||
chartId : null, | ||
} | ||
@@ -33,3 +34,3 @@ | ||
.append('clipPath') | ||
.attr('id', 'mark-clip') | ||
.attr('id', `mark-clip-${config.chartId}`) | ||
.append('rect') | ||
@@ -36,0 +37,0 @@ } |
import {keys} from "./constants" | ||
import * as d3 from "./d3-service" | ||
@@ -84,6 +85,7 @@ /** | ||
if (type === "time") { | ||
converted = new Date(str) | ||
converted = d3.timeParse("%m-%d-%Y")(str) | ||
} else if (type === "number") { | ||
converted = Number(str) | ||
} | ||
console.log("stringToType", str, type, converted) | ||
return converted | ||
@@ -122,1 +124,5 @@ } | ||
} | ||
export function uniqueId () { | ||
return `id-${Math.random().toString(36).substr(2, 16)}` | ||
} |
@@ -19,1 +19,3 @@ export const keys = { | ||
} | ||
export const MAX_MARK_WIDTH = 200 |
@@ -17,2 +17,3 @@ import * as d3 from "./helpers/d3-service" | ||
height: 500, | ||
chartId: null, | ||
chartType: null, | ||
@@ -83,3 +84,3 @@ colorSchema: ["skyblue"], | ||
.attr("class", "mark line") | ||
.attr('clip-path', 'url(#mark-clip)') | ||
.attr('clip-path', `url(#mark-clip-${config.chartId})`) | ||
.classed("y2-line", (d) => d[keys.GROUP] > 0) | ||
@@ -122,3 +123,3 @@ .attr("d", (d) => { | ||
.attr("class", "mark area") | ||
.attr('clip-path', 'url(#mark-clip)') | ||
.attr('clip-path', `url(#mark-clip-${config.chartId})`) | ||
.classed("y2-area", (d) => d[keys.GROUP] > 0) | ||
@@ -151,3 +152,3 @@ .attr("d", (d) => { | ||
.attr("class", "mark stacked-area") | ||
.attr('clip-path', 'url(#mark-clip)') | ||
.attr('clip-path', `url(#mark-clip-${config.chartId})`) | ||
.attr("d", seriesLine) | ||
@@ -154,0 +155,0 @@ .style("stroke", "none") |
import * as d3 from "./helpers/d3-service" | ||
import {keys, LEFT_AXIS_GROUP_INDEX, RIGHT_AXIS_GROUP_INDEX} from "./helpers/constants" | ||
import {keys, LEFT_AXIS_GROUP_INDEX, RIGHT_AXIS_GROUP_INDEX, MAX_MARK_WIDTH} from "./helpers/constants" | ||
import {getUnique, override, getSizes} from "./helpers/common" | ||
@@ -58,3 +58,3 @@ | ||
let domain = null | ||
const markW = hasBars(config.chartType) ? cache.chartWidth / _allKeys.length : 0 | ||
const markW = Math.min(hasBars(config.chartType) ? cache.chartWidth / _allKeys.length : 0, MAX_MARK_WIDTH) | ||
@@ -61,0 +61,0 @@ if (config.keyType === "time") { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1043933
6428