d3fc-flexi-chart
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -436,3 +436,3 @@ (function(g,f){typeof exports==='object'&&typeof module!=='undefined'?f(exports,require('d3-selection'),require('@d3fc/d3fc-data-join'),require('@d3fc/d3fc-rebind'),require('d3-scale'),require('@d3fc/d3fc-axis')):typeof define==='function'&&define.amd?define(['exports','d3-selection','@d3fc/d3fc-data-join','@d3fc/d3fc-rebind','d3-scale','@d3fc/d3fc-axis'],f):(g=g||self,f(g.fcFlexi={},g.d3,g.fc,g.fc,g.d3,g.fc));}(this,function(exports, d3Selection, d3fcDataJoin, d3fcRebind, d3Scale, d3fcAxis){'use strict';// Adapted from https://github.com/substack/insert-css | ||
var series = base.plotArea(); | ||
var contextType = series.contextType || '2d'; | ||
var contextType = series.contextType ? series.contextType() : '2d'; | ||
series.context(canvas.getContext(contextType))(data); | ||
@@ -439,0 +439,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
(function(g,f){typeof exports==="object"&&typeof module!=="undefined"?f(exports,require("d3-selection"),require("@d3fc/d3fc-data-join"),require("@d3fc/d3fc-rebind"),require("d3-scale"),require("@d3fc/d3fc-axis")):typeof define==="function"&&define.amd?define(["exports","d3-selection","@d3fc/d3fc-data-join","@d3fc/d3fc-rebind","d3-scale","@d3fc/d3fc-axis"],f):(g=g||self,f(g.fcFlexi={},g.d3,g.fc,g.fc,g.d3,g.fc))})(this,function(exports,d3Selection,d3fcDataJoin,d3fcRebind,d3Scale,d3fcAxis){"use strict";var css="d3fc-group.flexi-chart{width:100%;height:100%;overflow:hidden;display:grid;display:-ms-grid;grid-template-columns:minmax(1em,max-content) auto 1fr auto minmax(1em,max-content);-ms-grid-columns:minmax(1em,max-content) auto 1fr auto minmax(1em,max-content);grid-template-rows:minmax(1em,max-content) auto 1fr auto minmax(1em,max-content);-ms-grid-rows:minmax(1em,max-content) auto 1fr auto minmax(1em,max-content);}\nd3fc-group.flexi-chart>.top-label{align-self:center;-ms-grid-column-align:center;justify-self:center;-ms-grid-row-align:center;grid-column:3;-ms-grid-column:3;-ms-grid-row:1;-ms-grid-row:1;}\nd3fc-group.flexi-chart>.top-axis{grid-column:3;-ms-grid-column:3;grid-row:2;-ms-grid-row:2;}\nd3fc-group.flexi-chart>.left-label{width:1.2em;align-self:center;-ms-grid-column-align:center;justify-self:center;-ms-grid-row-align:center;grid-column:1;-ms-grid-column:1;grid-row:3;-ms-grid-row:3;}\nd3fc-group.flexi-chart>.left-axis{grid-column:2;-ms-grid-column:2;grid-row:3;-ms-grid-row:3;white-space:nowrap;}\nd3fc-group.flexi-chart>.plot-area{overflow:hidden;grid-column:3;-ms-grid-column:3;grid-row:3;-ms-grid-row:3;}\nd3fc-group.flexi-chart>.right-axis{grid-column:4;-ms-grid-column:4;grid-row:3;-ms-grid-row:3;white-space:nowrap;}\nd3fc-group.flexi-chart>.right-label{width:1.2em;align-self:center;-ms-grid-column-align:center;justify-self:center;-ms-grid-row-align:center;grid-column:5;-ms-grid-column:5;grid-row:3;-ms-grid-row:3;}\nd3fc-group.flexi-chart>.bottom-axis{grid-column:3;-ms-grid-column:3;grid-row:4;-ms-grid-row:4;}\nd3fc-group.flexi-chart>.bottom-label{height:1.2em;align-self:center;-ms-grid-column-align:center;justify-self:center;-ms-grid-row-align:center;grid-column:3;-ms-grid-column:3;grid-row:5;-ms-grid-row:5;}\nd3fc-group.flexi-chart>.left-axis>.axis-component,d3fc-group.flexi-chart>.right-axis>.axis-component{width:3em;height:100%;display:inline-block;}\nd3fc-group.flexi-chart>.top-axis>.axis-component,d3fc-group.flexi-chart>.bottom-axis>.axis-component{height:2em;}\nd3fc-group.flexi-chart>.plot-area>d3fc-svg,d3fc-group.flexi-chart>.plot-area>d3fc-canvas{height:100%;}\nd3fc-group.flexi-chart>.left-label>.label,d3fc-group.flexi-chart>.right-label>.label{transform:rotate(-90deg);white-space:nowrap;}\n";var styleElement=document.createElement("style");styleElement.setAttribute("type","text/css");document.querySelector("head").appendChild(styleElement);if(styleElement.styleSheet){styleElement.styleSheet.cssText+=css}else{styleElement.textContent+=css}var functor=function functor(v){return typeof v==="function"?v:function(){return v}};var chart=function(){var leftLabel=functor("");var rightLabel=functor("");var topLabel=functor("");var bottomLabel=functor("");var layers=[];var mapping=function mapping(d){return d};var decorate=function decorate(){};var containerDataJoin=d3fcDataJoin.dataJoin("d3fc-group","flexi-chart");var labelDataJoin=d3fcDataJoin.dataJoin("div","label-container").key(function(d){return d});var axisDataJoin=d3fcDataJoin.dataJoin("div","axis").key(function(d){return d});var axisComponentJoin=d3fcDataJoin.dataJoin("d3fc-svg","axis-component").key(function(d){return d});var layerDataJoin=function layerDataJoin(container,data){var selected=container.selectAll(".plot-area");var update=selected.data(data,function(d){return d});var enter=update.enter().append(function(d){return document.createElement(d.element)}).attr("class","plot-area");update.exit().remove();return update.merge(enter)};var propagateTransition=function propagateTransition(maybeTransition){return function(selection){return maybeTransition.selection?selection.transition(maybeTransition):selection}};var chart=function chart(selection){var transitionPropagator=propagateTransition(selection);var axes=[{id:"left",vertical:true,label:leftLabel},{id:"right",vertical:true,label:rightLabel},{id:"bottom",vertical:false,label:bottomLabel},{id:"top",vertical:false,label:topLabel}];selection.each(function(data,index,group){var container=containerDataJoin(d3Selection.select(group[index]),[data]);container.enter().attr("auto-resize","");var chartLabels=labelDataJoin(container,axes);chartLabels.enter().append("div").classed("label",true);chartLabels.attr("class",function(d){return"label ".concat(d.id,"-label")}).select(".label").text(function(d){return d.label(data)});var layerUsesAxis=function layerUsesAxis(name){return function(p){return p.yOrient()()===name||p.xOrient()()===name}};var anyLayerUsesAxis=function anyLayerUsesAxis(name){return layers.some(layerUsesAxis(name))};var drawAxis=function drawAxis(axisContainer,axis){var axisLayers=layers.filter(layerUsesAxis(axis.id));axisComponentJoin(axisContainer,axisLayers).style("height",function(d){return!axis.vertical&&d.xAxisHeight()(data)}).style("width",function(d){return axis.vertical&&d.yAxisWidth()(data)}).on("measure",function(d,i,nodes){var _event$detail=d3Selection.event.detail,width=_event$detail.width,height=_event$detail.height;if(axis.id==="top"||axis.id==="left"){d3Selection.select(nodes[i]).select("svg").attr("viewBox",axis.id==="top"?"0 ".concat(-height," ").concat(width," ").concat(height):"".concat(-width," 0 ").concat(width," ").concat(height))}}).on("draw",function(d,i,nodes){var axisComponent=d["".concat(axis.id,"Axis")]();var axisContainer=transitionPropagator(d3Selection.select(nodes[i]));axisContainer.select("svg").call(axisComponent)})};axisDataJoin(container,axes.filter(function(a){return anyLayerUsesAxis(a.id)})).attr("class",function(d){return"axis ".concat(d.id,"-axis")}).each(function(d,i,nodes){return drawAxis(d3Selection.select(nodes[i]),d)});layerDataJoin(container,layers).on("measure",function(d,i,nodes){var _event$detail2=d3Selection.event.detail,width=_event$detail2.width,height=_event$detail2.height;var layer=layers[i];layer.yScale().range([height,0]);layer.xScale().range([0,width])}).on("draw",function(d,i,nodes){var layer=layers[i];var surface=layer.element=="d3fc-svg"?"svg":"canvas";var layerData=mapping(data,i,layers);d3Selection.select(nodes[i]).select(surface).datum(layerData).call(layer)});container.each(function(d,i,nodes){return nodes[i].requestRedraw()});decorate(container,data,index)})};chart.leftLabel=function(){if(!arguments.length){return leftLabel}leftLabel=functor(arguments.length<=0?undefined:arguments[0]);return chart};chart.rightLabel=function(){if(!arguments.length){return rightLabel}rightLabel=functor(arguments.length<=0?undefined:arguments[0]);return chart};chart.topLabel=function(){if(!arguments.length){return topLabel}topLabel=functor(arguments.length<=0?undefined:arguments[0]);return chart};chart.bottomLabel=function(){if(!arguments.length){return bottomLabel}bottomLabel=functor(arguments.length<=0?undefined:arguments[0]);return chart};chart.layers=function(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}if(!args.length){return layers}layers=Array.isArray(args[0])?args[0]:args;return chart};chart.decorate=function(){if(!arguments.length){return decorate}decorate=arguments.length<=0?undefined:arguments[0];return chart};chart.mapping=function(){if(!arguments.length){return mapping}mapping=arguments.length<=0?undefined:arguments[0];return chart};return chart};var store=function(){var data={};var store=function store(target){for(var _i=0,_Object$keys=Object.keys(data);_i<_Object$keys.length;_i++){var key=_Object$keys[_i];target[key](data[key])}return target};for(var _len=arguments.length,names=new Array(_len),_key=0;_key<_len;_key++){names[_key]=arguments[_key]}var _loop=function _loop(){var name=_names[_i2];store[name]=function(){if(!arguments.length){return data[name]}data[name]=arguments.length<=0?undefined:arguments[0];return store}};for(var _i2=0,_names=names;_i2<_names.length;_i2++){_loop()}return store};var functor$1=function functor(v){return typeof v==="function"?v:function(){return v}};var layer=function(){var _getArguments=getArguments.apply(void 0,arguments),xScale=_getArguments.xScale,yScale=_getArguments.yScale,xAxis=_getArguments.xAxis,yAxis=_getArguments.yAxis;var xAxisHeight=functor$1(null);var yAxisWidth=functor$1(null);var yOrient=functor$1("right");var xOrient=functor$1("bottom");var plotArea=null;var xAxisStore=store("tickFormat","ticks","tickArguments","tickSize","tickSizeInner","tickSizeOuter","tickValues","tickPadding","tickCenterLabel");var xDecorate=function xDecorate(){};var yAxisStore=store("tickFormat","ticks","tickArguments","tickSize","tickSizeInner","tickSizeOuter","tickValues","tickPadding","tickCenterLabel");var yDecorate=function yDecorate(){};var layer=function layer(selection){plotArea.xScale(xScale).yScale(yScale)};layer.xScale=function(){return xScale};layer.yScale=function(){return yScale};layer.leftAxis=function(){return yAxisStore(yAxis.left(yScale).decorate(yDecorate))};layer.rightAxis=function(){return yAxisStore(yAxis.right(yScale).decorate(yDecorate))};layer.topAxis=function(){return xAxisStore(xAxis.top(xScale).decorate(xDecorate))};layer.bottomAxis=function(){return xAxisStore(xAxis.bottom(xScale).decorate(xDecorate))};var scaleExclusions=d3fcRebind.exclude(/range\w*/,/tickFormat/);d3fcRebind.rebindAll(layer,xScale,scaleExclusions,d3fcRebind.prefix("x"));d3fcRebind.rebindAll(layer,yScale,scaleExclusions,d3fcRebind.prefix("y"));d3fcRebind.rebindAll(layer,xAxisStore,d3fcRebind.prefix("x"));d3fcRebind.rebindAll(layer,yAxisStore,d3fcRebind.prefix("y"));layer.xAxisHeight=function(){if(!arguments.length){return xAxisHeight}xAxisHeight=functor$1(arguments.length<=0?undefined:arguments[0]);return layer};layer.yAxisWidth=function(){if(!arguments.length){return yAxisWidth}yAxisWidth=functor$1(arguments.length<=0?undefined:arguments[0]);return layer};layer.xOrient=function(){if(!arguments.length){return xOrient}xOrient=functor$1(arguments.length<=0?undefined:arguments[0]);return layer};layer.yOrient=function(){if(!arguments.length){return yOrient}yOrient=functor$1(arguments.length<=0?undefined:arguments[0]);return layer};layer.plotArea=function(){if(!arguments.length){return plotArea}plotArea=arguments.length<=0?undefined:arguments[0];return layer};layer.xDecorate=function(){if(!arguments.length){return xDecorate}xDecorate=arguments.length<=0?undefined:arguments[0];return layer};layer.yDecorate=function(){if(!arguments.length){return yDecorate}yDecorate=arguments.length<=0?undefined:arguments[0];return layer};return layer};var getArguments=function getArguments(){var defaultSettings={xScale:d3Scale.scaleIdentity(),yScale:d3Scale.scaleIdentity(),xAxis:{bottom:d3fcAxis.axisBottom,top:d3fcAxis.axisTop},yAxis:{right:d3fcAxis.axisRight,left:d3fcAxis.axisLeft}};for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}if(args.length===1&&!args[0].domain&&!args[0].range){return Object.assign(defaultSettings,args[0])}return Object.assign(defaultSettings,{xScale:args[0]||defaultSettings.xScale,yScale:args[1]||defaultSettings.yScale})};var layer$1=function(){var base=layer.apply(void 0,arguments);var propagateTransition=function propagateTransition(maybeTransition){return function(selection){return maybeTransition.selection?selection.transition(maybeTransition):selection}};var svgLayer=function svgLayer(selection){var transitionPropagator=propagateTransition(selection);base(selection);transitionPropagator(selection).call(base.plotArea())};d3fcRebind.rebindAll(svgLayer,base);svgLayer.element="d3fc-svg";return svgLayer};var layer$2=function(){var base=layer.apply(void 0,arguments);var canvasLayer=function canvasLayer(selection){base(selection);var canvas=selection.node();var data=selection.datum();var series=base.plotArea();var contextType=series.contextType||"2d";series.context(canvas.getContext(contextType))(data)};d3fcRebind.rebindAll(canvasLayer,base);canvasLayer.element="d3fc-canvas";return canvasLayer};exports.canvasLayer=layer$2;exports.chart=chart;exports.svgLayer=layer$1;Object.defineProperty(exports,"__esModule",{value:true})}); | ||
(function(g,f){typeof exports==="object"&&typeof module!=="undefined"?f(exports,require("d3-selection"),require("@d3fc/d3fc-data-join"),require("@d3fc/d3fc-rebind"),require("d3-scale"),require("@d3fc/d3fc-axis")):typeof define==="function"&&define.amd?define(["exports","d3-selection","@d3fc/d3fc-data-join","@d3fc/d3fc-rebind","d3-scale","@d3fc/d3fc-axis"],f):(g=g||self,f(g.fcFlexi={},g.d3,g.fc,g.fc,g.d3,g.fc))})(this,function(exports,d3Selection,d3fcDataJoin,d3fcRebind,d3Scale,d3fcAxis){"use strict";var css="d3fc-group.flexi-chart{width:100%;height:100%;overflow:hidden;display:grid;display:-ms-grid;grid-template-columns:minmax(1em,max-content) auto 1fr auto minmax(1em,max-content);-ms-grid-columns:minmax(1em,max-content) auto 1fr auto minmax(1em,max-content);grid-template-rows:minmax(1em,max-content) auto 1fr auto minmax(1em,max-content);-ms-grid-rows:minmax(1em,max-content) auto 1fr auto minmax(1em,max-content);}\nd3fc-group.flexi-chart>.top-label{align-self:center;-ms-grid-column-align:center;justify-self:center;-ms-grid-row-align:center;grid-column:3;-ms-grid-column:3;-ms-grid-row:1;-ms-grid-row:1;}\nd3fc-group.flexi-chart>.top-axis{grid-column:3;-ms-grid-column:3;grid-row:2;-ms-grid-row:2;}\nd3fc-group.flexi-chart>.left-label{width:1.2em;align-self:center;-ms-grid-column-align:center;justify-self:center;-ms-grid-row-align:center;grid-column:1;-ms-grid-column:1;grid-row:3;-ms-grid-row:3;}\nd3fc-group.flexi-chart>.left-axis{grid-column:2;-ms-grid-column:2;grid-row:3;-ms-grid-row:3;white-space:nowrap;}\nd3fc-group.flexi-chart>.plot-area{overflow:hidden;grid-column:3;-ms-grid-column:3;grid-row:3;-ms-grid-row:3;}\nd3fc-group.flexi-chart>.right-axis{grid-column:4;-ms-grid-column:4;grid-row:3;-ms-grid-row:3;white-space:nowrap;}\nd3fc-group.flexi-chart>.right-label{width:1.2em;align-self:center;-ms-grid-column-align:center;justify-self:center;-ms-grid-row-align:center;grid-column:5;-ms-grid-column:5;grid-row:3;-ms-grid-row:3;}\nd3fc-group.flexi-chart>.bottom-axis{grid-column:3;-ms-grid-column:3;grid-row:4;-ms-grid-row:4;}\nd3fc-group.flexi-chart>.bottom-label{height:1.2em;align-self:center;-ms-grid-column-align:center;justify-self:center;-ms-grid-row-align:center;grid-column:3;-ms-grid-column:3;grid-row:5;-ms-grid-row:5;}\nd3fc-group.flexi-chart>.left-axis>.axis-component,d3fc-group.flexi-chart>.right-axis>.axis-component{width:3em;height:100%;display:inline-block;}\nd3fc-group.flexi-chart>.top-axis>.axis-component,d3fc-group.flexi-chart>.bottom-axis>.axis-component{height:2em;}\nd3fc-group.flexi-chart>.plot-area>d3fc-svg,d3fc-group.flexi-chart>.plot-area>d3fc-canvas{height:100%;}\nd3fc-group.flexi-chart>.left-label>.label,d3fc-group.flexi-chart>.right-label>.label{transform:rotate(-90deg);white-space:nowrap;}\n";var styleElement=document.createElement("style");styleElement.setAttribute("type","text/css");document.querySelector("head").appendChild(styleElement);if(styleElement.styleSheet){styleElement.styleSheet.cssText+=css}else{styleElement.textContent+=css}var functor=function functor(v){return typeof v==="function"?v:function(){return v}};var chart=function(){var leftLabel=functor("");var rightLabel=functor("");var topLabel=functor("");var bottomLabel=functor("");var layers=[];var mapping=function mapping(d){return d};var decorate=function decorate(){};var containerDataJoin=d3fcDataJoin.dataJoin("d3fc-group","flexi-chart");var labelDataJoin=d3fcDataJoin.dataJoin("div","label-container").key(function(d){return d});var axisDataJoin=d3fcDataJoin.dataJoin("div","axis").key(function(d){return d});var axisComponentJoin=d3fcDataJoin.dataJoin("d3fc-svg","axis-component").key(function(d){return d});var layerDataJoin=function layerDataJoin(container,data){var selected=container.selectAll(".plot-area");var update=selected.data(data,function(d){return d});var enter=update.enter().append(function(d){return document.createElement(d.element)}).attr("class","plot-area");update.exit().remove();return update.merge(enter)};var propagateTransition=function propagateTransition(maybeTransition){return function(selection){return maybeTransition.selection?selection.transition(maybeTransition):selection}};var chart=function chart(selection){var transitionPropagator=propagateTransition(selection);var axes=[{id:"left",vertical:true,label:leftLabel},{id:"right",vertical:true,label:rightLabel},{id:"bottom",vertical:false,label:bottomLabel},{id:"top",vertical:false,label:topLabel}];selection.each(function(data,index,group){var container=containerDataJoin(d3Selection.select(group[index]),[data]);container.enter().attr("auto-resize","");var chartLabels=labelDataJoin(container,axes);chartLabels.enter().append("div").classed("label",true);chartLabels.attr("class",function(d){return"label ".concat(d.id,"-label")}).select(".label").text(function(d){return d.label(data)});var layerUsesAxis=function layerUsesAxis(name){return function(p){return p.yOrient()()===name||p.xOrient()()===name}};var anyLayerUsesAxis=function anyLayerUsesAxis(name){return layers.some(layerUsesAxis(name))};var drawAxis=function drawAxis(axisContainer,axis){var axisLayers=layers.filter(layerUsesAxis(axis.id));axisComponentJoin(axisContainer,axisLayers).style("height",function(d){return!axis.vertical&&d.xAxisHeight()(data)}).style("width",function(d){return axis.vertical&&d.yAxisWidth()(data)}).on("measure",function(d,i,nodes){var _event$detail=d3Selection.event.detail,width=_event$detail.width,height=_event$detail.height;if(axis.id==="top"||axis.id==="left"){d3Selection.select(nodes[i]).select("svg").attr("viewBox",axis.id==="top"?"0 ".concat(-height," ").concat(width," ").concat(height):"".concat(-width," 0 ").concat(width," ").concat(height))}}).on("draw",function(d,i,nodes){var axisComponent=d["".concat(axis.id,"Axis")]();var axisContainer=transitionPropagator(d3Selection.select(nodes[i]));axisContainer.select("svg").call(axisComponent)})};axisDataJoin(container,axes.filter(function(a){return anyLayerUsesAxis(a.id)})).attr("class",function(d){return"axis ".concat(d.id,"-axis")}).each(function(d,i,nodes){return drawAxis(d3Selection.select(nodes[i]),d)});layerDataJoin(container,layers).on("measure",function(d,i,nodes){var _event$detail2=d3Selection.event.detail,width=_event$detail2.width,height=_event$detail2.height;var layer=layers[i];layer.yScale().range([height,0]);layer.xScale().range([0,width])}).on("draw",function(d,i,nodes){var layer=layers[i];var surface=layer.element=="d3fc-svg"?"svg":"canvas";var layerData=mapping(data,i,layers);d3Selection.select(nodes[i]).select(surface).datum(layerData).call(layer)});container.each(function(d,i,nodes){return nodes[i].requestRedraw()});decorate(container,data,index)})};chart.leftLabel=function(){if(!arguments.length){return leftLabel}leftLabel=functor(arguments.length<=0?undefined:arguments[0]);return chart};chart.rightLabel=function(){if(!arguments.length){return rightLabel}rightLabel=functor(arguments.length<=0?undefined:arguments[0]);return chart};chart.topLabel=function(){if(!arguments.length){return topLabel}topLabel=functor(arguments.length<=0?undefined:arguments[0]);return chart};chart.bottomLabel=function(){if(!arguments.length){return bottomLabel}bottomLabel=functor(arguments.length<=0?undefined:arguments[0]);return chart};chart.layers=function(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}if(!args.length){return layers}layers=Array.isArray(args[0])?args[0]:args;return chart};chart.decorate=function(){if(!arguments.length){return decorate}decorate=arguments.length<=0?undefined:arguments[0];return chart};chart.mapping=function(){if(!arguments.length){return mapping}mapping=arguments.length<=0?undefined:arguments[0];return chart};return chart};var store=function(){var data={};var store=function store(target){for(var _i=0,_Object$keys=Object.keys(data);_i<_Object$keys.length;_i++){var key=_Object$keys[_i];target[key](data[key])}return target};for(var _len=arguments.length,names=new Array(_len),_key=0;_key<_len;_key++){names[_key]=arguments[_key]}var _loop=function _loop(){var name=_names[_i2];store[name]=function(){if(!arguments.length){return data[name]}data[name]=arguments.length<=0?undefined:arguments[0];return store}};for(var _i2=0,_names=names;_i2<_names.length;_i2++){_loop()}return store};var functor$1=function functor(v){return typeof v==="function"?v:function(){return v}};var layer=function(){var _getArguments=getArguments.apply(void 0,arguments),xScale=_getArguments.xScale,yScale=_getArguments.yScale,xAxis=_getArguments.xAxis,yAxis=_getArguments.yAxis;var xAxisHeight=functor$1(null);var yAxisWidth=functor$1(null);var yOrient=functor$1("right");var xOrient=functor$1("bottom");var plotArea=null;var xAxisStore=store("tickFormat","ticks","tickArguments","tickSize","tickSizeInner","tickSizeOuter","tickValues","tickPadding","tickCenterLabel");var xDecorate=function xDecorate(){};var yAxisStore=store("tickFormat","ticks","tickArguments","tickSize","tickSizeInner","tickSizeOuter","tickValues","tickPadding","tickCenterLabel");var yDecorate=function yDecorate(){};var layer=function layer(selection){plotArea.xScale(xScale).yScale(yScale)};layer.xScale=function(){return xScale};layer.yScale=function(){return yScale};layer.leftAxis=function(){return yAxisStore(yAxis.left(yScale).decorate(yDecorate))};layer.rightAxis=function(){return yAxisStore(yAxis.right(yScale).decorate(yDecorate))};layer.topAxis=function(){return xAxisStore(xAxis.top(xScale).decorate(xDecorate))};layer.bottomAxis=function(){return xAxisStore(xAxis.bottom(xScale).decorate(xDecorate))};var scaleExclusions=d3fcRebind.exclude(/range\w*/,/tickFormat/);d3fcRebind.rebindAll(layer,xScale,scaleExclusions,d3fcRebind.prefix("x"));d3fcRebind.rebindAll(layer,yScale,scaleExclusions,d3fcRebind.prefix("y"));d3fcRebind.rebindAll(layer,xAxisStore,d3fcRebind.prefix("x"));d3fcRebind.rebindAll(layer,yAxisStore,d3fcRebind.prefix("y"));layer.xAxisHeight=function(){if(!arguments.length){return xAxisHeight}xAxisHeight=functor$1(arguments.length<=0?undefined:arguments[0]);return layer};layer.yAxisWidth=function(){if(!arguments.length){return yAxisWidth}yAxisWidth=functor$1(arguments.length<=0?undefined:arguments[0]);return layer};layer.xOrient=function(){if(!arguments.length){return xOrient}xOrient=functor$1(arguments.length<=0?undefined:arguments[0]);return layer};layer.yOrient=function(){if(!arguments.length){return yOrient}yOrient=functor$1(arguments.length<=0?undefined:arguments[0]);return layer};layer.plotArea=function(){if(!arguments.length){return plotArea}plotArea=arguments.length<=0?undefined:arguments[0];return layer};layer.xDecorate=function(){if(!arguments.length){return xDecorate}xDecorate=arguments.length<=0?undefined:arguments[0];return layer};layer.yDecorate=function(){if(!arguments.length){return yDecorate}yDecorate=arguments.length<=0?undefined:arguments[0];return layer};return layer};var getArguments=function getArguments(){var defaultSettings={xScale:d3Scale.scaleIdentity(),yScale:d3Scale.scaleIdentity(),xAxis:{bottom:d3fcAxis.axisBottom,top:d3fcAxis.axisTop},yAxis:{right:d3fcAxis.axisRight,left:d3fcAxis.axisLeft}};for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}if(args.length===1&&!args[0].domain&&!args[0].range){return Object.assign(defaultSettings,args[0])}return Object.assign(defaultSettings,{xScale:args[0]||defaultSettings.xScale,yScale:args[1]||defaultSettings.yScale})};var layer$1=function(){var base=layer.apply(void 0,arguments);var propagateTransition=function propagateTransition(maybeTransition){return function(selection){return maybeTransition.selection?selection.transition(maybeTransition):selection}};var svgLayer=function svgLayer(selection){var transitionPropagator=propagateTransition(selection);base(selection);transitionPropagator(selection).call(base.plotArea())};d3fcRebind.rebindAll(svgLayer,base);svgLayer.element="d3fc-svg";return svgLayer};var layer$2=function(){var base=layer.apply(void 0,arguments);var canvasLayer=function canvasLayer(selection){base(selection);var canvas=selection.node();var data=selection.datum();var series=base.plotArea();var contextType=series.contextType?series.contextType():"2d";series.context(canvas.getContext(contextType))(data)};d3fcRebind.rebindAll(canvasLayer,base);canvasLayer.element="d3fc-canvas";return canvasLayer};exports.canvasLayer=layer$2;exports.chart=chart;exports.svgLayer=layer$1;Object.defineProperty(exports,"__esModule",{value:true})}); |
{ | ||
"name": "d3fc-flexi-chart", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "A flexible alternative to the d3fc cartesian chart", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -14,3 +14,3 @@ import { rebindAll } from '@d3fc/d3fc-rebind'; | ||
const series = base.plotArea(); | ||
let contextType = series.contextType || '2d'; | ||
let contextType = series.contextType ? series.contextType() : '2d'; | ||
series.context(canvas.getContext(contextType))(data); | ||
@@ -17,0 +17,0 @@ }; |
Sorry, the diff of this file is not supported yet
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
149371