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

color-legend-element

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

color-legend-element - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

build/test/x-scale-axis_test.d.ts

2

build/color-legend-element.bundled.js

@@ -91,3 +91,3 @@ /**

<text fill="currentColor" y="${l}" dy="0.71em">${e(t)}</text>
</g>`))}</g>`}getColorRamp(t,i=256){const n=document.createElement("canvas");n.setAttribute("height","1"),n.setAttribute("width",`${i}`);const e=n.getContext("2d");for(let n=0;n<i;n++)e.fillStyle=t(n/(i-1)),e.fillRect(n,0,1,1);return n}}const on=[0,1],an=["#ffffcc","#a1dab4","#41b6c4","#2c7fb8","#253494"],hn=["domain","range","interpolator","scaleType"],un=["scaleType","ticks","tickSize","tickValues","tickFormat","domain","range","marginLeft","marginRight","marginBottom","marginTop","width","height"];class ln{constructor(t){this.cle=t}setXScale(){const{scaleType:t,marginLeft:i,width:n,marginRight:e}=this.cle;switch(t){case"continuous":this.xScale=Ki().domain(this.cle.domain).range([i,n-e]);break;case"discrete":case"threshold":this.xScale=Ki().domain([this.cle.domain.at(0),this.cle.domain.at(-1)]).rangeRound([i,n-e]);break;case"categorical":this.xScale=null;break;default:throw new Error(`Unrecognized scaleType: ${t}`)}}handleAxisTicks(){var t,i,n;const{scaleType:e}=this.cle;if("continuous"!==e&&"categorical"!==e){const[n,e]=this.xScale.domain();this.cle.tickValues=this.cle.tickValues||[n,...(null===(i=null===(t=this.cle.colorScale)||void 0===t?void 0:t.thresholds)||void 0===i?void 0:i.call(t))||this.cle.colorScale.domain(),e]}(null===(n=this.cle.tickFormat)||void 0===n?void 0:n.length)?this.cle.tickFormatter=Hi(this.cle.tickFormat):this.cle.tickFormatter=this.xScale.tickFormat(this.cle.ticks||5,this.cle.tickFormat||".1f")}}const cn=((t,...n)=>{const r=1===t.length?t[0]:n.reduce(((i,n,e)=>i+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+t[e+1]),t[0]);return new e(r,i)})`
</g>`))}</g>`}getColorRamp(t,i=256){const n=document.createElement("canvas");n.setAttribute("height","1"),n.setAttribute("width",`${i}`);const e=n.getContext("2d");for(let n=0;n<i;n++)e.fillStyle=t(n/(i-1)),e.fillRect(n,0,1,1);return n}}const on=[0,1],an=["#ffffcc","#a1dab4","#41b6c4","#2c7fb8","#253494"],hn=["domain","range","interpolator","scaleType"],un=["scaleType","ticks","tickSize","tickValues","tickFormat","domain","range","marginLeft","marginRight","marginBottom","marginTop","width","height"];class ln{constructor(t){this.cle=t}setXScale(){const{scaleType:t,marginLeft:i,width:n,marginRight:e}=this.cle;switch(t){case"continuous":this.xScale=Ki().domain(this.cle.domain).range([i,n-e]);break;case"discrete":case"threshold":this.xScale=Ki().domain([this.cle.domain[0],this.cle.domain[this.cle.domain.length-1]]).rangeRound([i,n-e]);break;case"categorical":this.xScale=null;break;default:throw new Error(`Unrecognized scaleType: ${t}`)}}handleAxisTicks(){var t,i,n;const{scaleType:e}=this.cle;if("continuous"!==e&&"categorical"!==e){const[n,e]=this.xScale.domain();this.cle.tickValues=this.cle.tickValues||[n,...(null===(i=null===(t=this.cle.colorScale)||void 0===t?void 0:t.thresholds)||void 0===i?void 0:i.call(t))||this.cle.colorScale.domain(),e]}(null===(n=this.cle.tickFormat)||void 0===n?void 0:n.length)?this.cle.tickFormatter=Hi(this.cle.tickFormat):this.cle.tickFormatter=this.xScale.tickFormat(this.cle.ticks||5,this.cle.tickFormat||".1f")}}const cn=((t,...n)=>{const r=1===t.length?t[0]:n.reduce(((i,n,e)=>i+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+t[e+1]),t[0]);return new e(r,i)})`
:host {

@@ -94,0 +94,0 @@ --cle-font-family: sans-serif;

@@ -91,3 +91,3 @@ var t,i;t=this,i=function(t){

<text fill="currentColor" y="${l}" dy="0.71em">${e(t)}</text>
</g>`))}</g>`}getColorRamp(t,i=256){const n=document.createElement("canvas");n.setAttribute("height","1"),n.setAttribute("width",`${i}`);const e=n.getContext("2d");for(let n=0;n<i;n++)e.fillStyle=t(n/(i-1)),e.fillRect(n,0,1,1);return n}}const ln=[0,1],cn=["#ffffcc","#a1dab4","#41b6c4","#2c7fb8","#253494"],fn=["domain","range","interpolator","scaleType"],dn=["scaleType","ticks","tickSize","tickValues","tickFormat","domain","range","marginLeft","marginRight","marginBottom","marginTop","width","height"];class vn{constructor(t){this.cle=t}setXScale(){const{scaleType:t,marginLeft:i,width:n,marginRight:e}=this.cle;switch(t){case"continuous":this.xScale=Qi().domain(this.cle.domain).range([i,n-e]);break;case"discrete":case"threshold":this.xScale=Qi().domain([this.cle.domain.at(0),this.cle.domain.at(-1)]).rangeRound([i,n-e]);break;case"categorical":this.xScale=null;break;default:throw new Error(`Unrecognized scaleType: ${t}`)}}handleAxisTicks(){var t,i,n;const{scaleType:e}=this.cle;if("continuous"!==e&&"categorical"!==e){const[n,e]=this.xScale.domain();this.cle.tickValues=this.cle.tickValues||[n,...(null===(i=null===(t=this.cle.colorScale)||void 0===t?void 0:t.thresholds)||void 0===i?void 0:i.call(t))||this.cle.colorScale.domain(),e]}(null===(n=this.cle.tickFormat)||void 0===n?void 0:n.length)?this.cle.tickFormatter=Xi(this.cle.tickFormat):this.cle.tickFormatter=this.xScale.tickFormat(this.cle.ticks||5,this.cle.tickFormat||".1f")}}const gn=((t,...i)=>{const e=1===t.length?t[0]:i.reduce(((i,n,e)=>i+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+t[e+1]),t[0]);return new r(e,n)})`
</g>`))}</g>`}getColorRamp(t,i=256){const n=document.createElement("canvas");n.setAttribute("height","1"),n.setAttribute("width",`${i}`);const e=n.getContext("2d");for(let n=0;n<i;n++)e.fillStyle=t(n/(i-1)),e.fillRect(n,0,1,1);return n}}const ln=[0,1],cn=["#ffffcc","#a1dab4","#41b6c4","#2c7fb8","#253494"],fn=["domain","range","interpolator","scaleType"],dn=["scaleType","ticks","tickSize","tickValues","tickFormat","domain","range","marginLeft","marginRight","marginBottom","marginTop","width","height"];class vn{constructor(t){this.cle=t}setXScale(){const{scaleType:t,marginLeft:i,width:n,marginRight:e}=this.cle;switch(t){case"continuous":this.xScale=Qi().domain(this.cle.domain).range([i,n-e]);break;case"discrete":case"threshold":this.xScale=Qi().domain([this.cle.domain[0],this.cle.domain[this.cle.domain.length-1]]).rangeRound([i,n-e]);break;case"categorical":this.xScale=null;break;default:throw new Error(`Unrecognized scaleType: ${t}`)}}handleAxisTicks(){var t,i,n;const{scaleType:e}=this.cle;if("continuous"!==e&&"categorical"!==e){const[n,e]=this.xScale.domain();this.cle.tickValues=this.cle.tickValues||[n,...(null===(i=null===(t=this.cle.colorScale)||void 0===t?void 0:t.thresholds)||void 0===i?void 0:i.call(t))||this.cle.colorScale.domain(),e]}(null===(n=this.cle.tickFormat)||void 0===n?void 0:n.length)?this.cle.tickFormatter=Xi(this.cle.tickFormat):this.cle.tickFormatter=this.xScale.tickFormat(this.cle.ticks||5,this.cle.tickFormat||".1f")}}const gn=((t,...i)=>{const e=1===t.length?t[0]:i.reduce(((i,n,e)=>i+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+t[e+1]),t[0]);return new r(e,n)})`
:host {

@@ -94,0 +94,0 @@ --cle-font-family: sans-serif;

@@ -23,4 +23,4 @@ import { scaleLinear } from "d3-scale";

.domain([
this.cle.domain.at(0),
this.cle.domain.at(-1),
this.cle.domain[0],
this.cle.domain[this.cle.domain.length - 1],
])

@@ -27,0 +27,0 @@ .rangeRound([marginLeft, width - marginRight]);

{
"name": "color-legend-element",
"version": "1.0.2",
"version": "1.0.3",
"description": "A custom element (web component) suitable for use as a legend in data visualizations",

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

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