Skip to content

Commit

Permalink
#5560 rewrite the plot domain mapping, range and axis (#7707)
Browse files Browse the repository at this point in the history
* #5560 rewrite calcMapping and calcRange

* #5560 rewrite PlotAxis

* #5560 refactor PlotAxis

* #5560 split Axis to TimeAxis and DefaultAxis

* Update DefaultAxis.ts

* Update TimeAxis.ts
  • Loading branch information
Mariusz Jurowicz authored and LeeTZ committed Jul 23, 2018
1 parent 7ccb4e8 commit 1af7440
Show file tree
Hide file tree
Showing 32 changed files with 999 additions and 639 deletions.
4 changes: 2 additions & 2 deletions js/notebook/src/plot/auxes/plotAuxBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ define([
var focus = scope.plotFocus.getFocus();
var eles = this.elements,
eleprops = this.elementProps;
var mapX = scope.data2scrXi,
mapY = scope.data2scrYi;
var mapX = scope.plotRange.data2scrXi,
mapY = scope.plotRange.data2scrYi;
var skipped = false;

eleprops.length = 0;
Expand Down
4 changes: 2 additions & 2 deletions js/notebook/src/plot/auxes/plotAuxRiver.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ define([
var focus = scope.plotFocus.getFocus();
var eles = this.elements,
eleprops = this.elementProps;
var mapX = scope.data2scrXi,
mapY = scope.data2scrYi;
var mapX = scope.plotRange.data2scrXi,
mapY = scope.plotRange.data2scrYi;
var pstr = "";

eleprops.length = 0;
Expand Down
4 changes: 2 additions & 2 deletions js/notebook/src/plot/auxes/plotAuxStem.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ define([
var focus = scope.plotFocus.getFocus();
var eles = this.elements,
eleprops = this.elementProps;
var mapX = scope.data2scrXi,
mapY = scope.data2scrYi;
var mapX = scope.plotRange.data2scrXi,
mapY = scope.plotRange.data2scrYi;
var skipped = false;

eleprops.length = 0;
Expand Down
4 changes: 2 additions & 2 deletions js/notebook/src/plot/lod/plotLodBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ define([
var focus = scope.plotFocus.getFocus();
var eles = this.elements,
eleprops = this.elementProps;
var mapX = scope.data2scrXi,
mapY = scope.data2scrYi;
var mapX = scope.plotRange.data2scrXi,
mapY = scope.plotRange.data2scrYi;
var fixed = scope.renderFixed;

eleprops.length = 0;
Expand Down
4 changes: 2 additions & 2 deletions js/notebook/src/plot/lod/plotLodLine.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ define([
PlotLodLine.prototype.prepare = function(scope, gid) {
var focus = scope.plotFocus.getFocus();
var eleprops = this.elementProps;
var mapX = scope.data2scrXi,
mapY = scope.data2scrYi;
var mapX = scope.plotRange.data2scrXi,
mapY = scope.plotRange.data2scrYi;
var pstr = "", skipped = false;

eleprops.length = 0;
Expand Down
6 changes: 3 additions & 3 deletions js/notebook/src/plot/lod/plotLodPoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ define([
var focus = scope.plotFocus.getFocus();
var eles = this.elementSamples,
eleprops = this.elementProps;
var mapX = scope.data2scrXi,
mapY = scope.data2scrYi;
var mapX = scope.plotRange.data2scrXi,
mapY = scope.plotRange.data2scrYi;
var fixed = scope.renderFixed;

eleprops.length = 0;
Expand Down Expand Up @@ -154,7 +154,7 @@ define([
.transition()
.duration(plotUtils.getHighlightDuration())
.attr("points", function(d) {
var mapX = scope.data2scrXi, mapY = scope.data2scrYi;
var mapX = scope.plotRange.data2scrXi, mapY = scope.plotRange.data2scrYi;
var ele = d.ele, x = mapX(ele.x), y = mapY(ele.y),
s = plotUtils.getHighlightedSize(ele.size, highlighted);
var pstr = "";
Expand Down
4 changes: 2 additions & 2 deletions js/notebook/src/plot/lod/plotLodRiver.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ define([
var focus = scope.plotFocus.getFocus();
var eles = this.elements,
eleprops = this.elementProps;
var mapX = scope.data2scrXi,
mapY = scope.data2scrYi;
var mapX = scope.plotRange.data2scrXi,
mapY = scope.plotRange.data2scrYi;
var pstr = "", pd = "";

eleprops.length = 0;
Expand Down
4 changes: 2 additions & 2 deletions js/notebook/src/plot/lod/plotLodStem.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ define([
var focus = scope.plotFocus.getFocus();
var eles = this.elements,
eleprops = this.elementProps;
var mapX = scope.plotFocus.data2scrXi,
mapY = scope.data2scrYi;
var mapX = scope.plotFocus.plotRange.data2scrXi,
mapY = scope.plotRange.data2scrYi;
var fixed = scope.renderFixed;

eleprops.length = 0;
Expand Down
6 changes: 3 additions & 3 deletions js/notebook/src/plot/plotFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
define([
'./std/plotline',
'./std/plotarea',
'./std/plotaxis',
'./std/plotconstband',
'./std/plotconstline',
'./std/plottext',
Expand All @@ -36,7 +35,6 @@ define([
], function(
PlotLine,
PlotArea,
PlotAxis,
PlotConstband,
PlotConstline,
PlotText,
Expand All @@ -53,6 +51,8 @@ define([
PlotAreaLodLoader,
PlotPointLodLoader
) {
var TimeAxis = require('./std/axis/TimeAxis').default;

var plotFactory = {
createPlotItem : function(item, lodthresh) {
if (!lodthresh){
Expand Down Expand Up @@ -162,7 +162,7 @@ define([
item.__proto__ = PlotText.prototype;
break;
case "axis":
item.__proto__ = PlotAxis.prototype;
item.__proto__ = TimeAxis.prototype;
break;
case "treemapnode":
item.__proto__ = PlotTreeMapNode.prototype;
Expand Down
8 changes: 3 additions & 5 deletions js/notebook/src/plot/plotFormatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,15 @@ define([
'./plotConverter',
'./plotUtils',
'./plotFactory',
'./std/plotaxis',
'./heatmapconverter'
],function(
_,
plotConverter,
plotUtils,
plotFactory,
PlotAxis,
heatmapConverter
) {

var PlotAxisFactory = require('./std/axis/PlotAxisFactory').default;
var createNewModel = function (model) {

var newmodel;
Expand Down Expand Up @@ -593,7 +591,7 @@ define([
var vrange = model.vrange;
var xAxisLabel = model.xAxis.label;

var xAxis = new PlotAxis(model.xAxis.type);
var xAxis = PlotAxisFactory.getPlotAxis(model.xAxis.type);

if (xAxis.axisType === "category") {
xAxis.setRange(vrange.xl, vrange.xr, model.xAxis.base);
Expand All @@ -614,7 +612,7 @@ define([

var label = modelAxis.label;

var axis = new PlotAxis(modelAxis.type);
var axis = PlotAxisFactory.getPlotAxis(modelAxis.type);

if (axis.axisType === "category") {
axis.setRange(vrange.xl, vrange.xr, model.xAxis.base);
Expand Down
Loading

0 comments on commit 1af7440

Please sign in to comment.