diff --git a/src/viewer/Band.ts b/src/viewer/Band.ts
deleted file mode 100644
index 43aec38f..00000000
--- a/src/viewer/Band.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-///
-///
-///
-
-module InteractiveDataDisplay {
- PlotRegistry["area"] = {
- initialize(plotDefinition: PlotInfo, viewState: ViewState, chart: IDDPlot) {
- var div = $("
")
- .attr("data-idd-name", plotDefinition.displayName)
- .appendTo(chart.host);
- var bandgraph = new InteractiveDataDisplay.Area(div, chart.master);
- chart.addChild(bandgraph);
- return [bandgraph];
- },
-
- draw(plots: IDDPlot[], plotDefinition: PlotInfo) {
- // The method actually just passed data from plotDefinition to IDD plot
- // except it also can sort data series by x.
- var plot = plots[0];
- var bandDef = plotDefinition;
- plot.draw(bandDef);
- }
- }
-}
\ No newline at end of file
diff --git a/src/viewer/Fallback.ts b/src/viewer/Fallback.ts
index f291bbb3..15082308 100644
--- a/src/viewer/Fallback.ts
+++ b/src/viewer/Fallback.ts
@@ -1,28 +1,7 @@
///
///
-///
module InteractiveDataDisplay {
- PlotRegistry["fallback"] = {
- initialize(plotDefinition: PlotInfo, viewState: ViewState, chart: IDDPlot) {
- var div = $("")
- .attr("data-idd-name", plotDefinition.displayName)
- .appendTo(chart.host);
- var plot = new FallbackPlot(div, chart.master);
- chart.addChild(plot);
- return [plot];
- },
-
- draw(plots: IDDPlot[], plotDefinition: PlotInfo) {
- var drawArgs = {
- kind: plotDefinition.kind,
- error: plotDefinition["error"]
- }
- plots[0].draw(drawArgs);
-
- }
- }
-
export function FallbackPlot(div, master) {
var that = this;
diff --git a/src/viewer/Heatmap.ts b/src/viewer/Heatmap.ts
deleted file mode 100644
index 244409f1..00000000
--- a/src/viewer/Heatmap.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-///
-///
-///
-
-module InteractiveDataDisplay {
- PlotRegistry["heatmap"] = {
- initialize(plotDefinition: PlotInfo, viewState, chart: IDDPlot) {
- var div = $("")
- .attr("data-idd-name", plotDefinition.displayName)
- .appendTo(chart.host);
- var heatmap = new InteractiveDataDisplay.Heatmap(div, chart.master);
- chart.addChild(heatmap);
-
- var plots = [heatmap];
- return plots;
- },
-
- draw(plots: IDDPlot[], plotDefinition: PlotInfo) {
- var heatmap = plotDefinition;
- plots[0].draw(heatmap, heatmap.titles);
- }
- }
-}
\ No newline at end of file
diff --git a/src/viewer/Line.ts b/src/viewer/Line.ts
deleted file mode 100644
index 5a26e97a..00000000
--- a/src/viewer/Line.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-///
-///
-///
-
-module InteractiveDataDisplay {
- PlotRegistry["line"] = {
- initialize(plotDefinition: PlotInfo, viewState: ViewState, chart: IDDPlot) {
- var div = $("")
- .attr("data-idd-name", plotDefinition.displayName)
- .appendTo(chart.host);
- var plot = new InteractiveDataDisplay.Polyline(div, chart.master);
- chart.addChild(plot);
- return [plot];
- },
-
- draw(plots: IDDPlot[], plotDefinition: PlotInfo) {
- // The method actually just passed data from plotDefinition to IDD plot
- // except it also can sort data series by x.
- var plot = plots[0];
- var lineDef = plotDefinition;
- plot.draw(lineDef);
- }
- }
-}
\ No newline at end of file
diff --git a/src/viewer/Markers.ts b/src/viewer/Markers.ts
deleted file mode 100644
index 17a225e0..00000000
--- a/src/viewer/Markers.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-///
-///
-///
-
-module InteractiveDataDisplay {
- PlotRegistry["markers"] = {
- initialize(plotDefinition: PlotInfo, viewState: ViewState, chart: IDDPlot) {
- var div = $("")
- .attr("data-idd-name", plotDefinition.displayName)
- .appendTo(chart.host);
- var markerGraph = new InteractiveDataDisplay.Markers(div, chart.master);
- chart.addChild(markerGraph);
- return [markerGraph];
- },
-
- draw(plots: IDDPlot[], plotDefinition: PlotInfo) {
- var plot = plotDefinition;
- plots[0].draw(plot, plot.titles);
- }
- }
-}
\ No newline at end of file
diff --git a/src/viewer/Plot.ts b/src/viewer/Plot.ts
index fb4c2d26..e1a57a0a 100644
--- a/src/viewer/Plot.ts
+++ b/src/viewer/Plot.ts
@@ -1,7 +1,6 @@
///
///
///
-///
///
module Plot {
export module MarkerShape {
diff --git a/src/viewer/PlotList.ts b/src/viewer/PlotList.ts
index 1de4ae21..23de28f0 100644
--- a/src/viewer/PlotList.ts
+++ b/src/viewer/PlotList.ts
@@ -1,6 +1,5 @@
///
///
-///
///
module InteractiveDataDisplay {
diff --git a/src/viewer/PlotRegistry.ts b/src/viewer/PlotRegistry.ts
deleted file mode 100644
index 5cc725d9..00000000
--- a/src/viewer/PlotRegistry.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-///
-///
-module InteractiveDataDisplay {
- export type PlotRegistry = {
- [plotKind: string]: IDDPlotFactory;
- }
- export interface IDDPlotFactory {
- initialize(plotDefinition: PlotInfo, viewState, chart: IDDPlot): IDDPlot[];
- draw(plots: IDDPlot[], plotDefinition: PlotInfo): void;
- }
- /* A libary of plots supported by the ChartViewer. */
- export var PlotRegistry: PlotRegistry = {}
-}
\ No newline at end of file
diff --git a/src/viewer/PlotViewer.ts b/src/viewer/PlotViewer.ts
index f2e68c78..73567586 100644
--- a/src/viewer/PlotViewer.ts
+++ b/src/viewer/PlotViewer.ts
@@ -227,16 +227,34 @@ module InteractiveDataDisplay {
}
private addPlot(p: PlotViewerItem) {
- var factory = PlotRegistry[p.Definition.kind] ? PlotRegistry[p.Definition.kind] : PlotRegistry["fallback"];
- p.Plots = factory.initialize(p.Definition, this.persistentViewState, this.iddChart);
+ var div = $("")
+ .attr("data-idd-name", p.Definition.displayName)
+ .appendTo(this.iddChart.host);
+ var new_plot;
+ switch (p.Definition.kind) {
+ case "line":
+ new_plot = new InteractiveDataDisplay.Polyline(div, this.iddChart.master);
+ break;
+ case "markers":
+ new_plot = new InteractiveDataDisplay.Markers(div, this.iddChart.master);
+ break;
+ case "heatmap":
+ new_plot = new InteractiveDataDisplay.Heatmap(div, this.iddChart.master);
+ break;
+ case "area":
+ new_plot = new InteractiveDataDisplay.Area(div, this.iddChart.master);
+ break;
+ default:
+ new_plot = new InteractiveDataDisplay.FallbackPlot(div, this.iddChart.master);
+ }
+ this.iddChart.addChild(new_plot);
+ p.Plots = [new_plot];
try {
- factory.draw(p.Plots, p.Definition);
+ p.Plots[0].draw(p.Definition, p.Definition.titles);
} catch (ex) {
if (p.Plots !== undefined) p.Plots.forEach(function (graph) { graph.remove(); });
- factory = PlotRegistry["fallback"];
p.Definition["error"] = ex.message;
- p.Plots = factory.initialize(p.Definition, this.persistentViewState, this.iddChart);
- factory.draw(p.Plots, p.Definition);
+ p.Plots = new_plot = new InteractiveDataDisplay.FallbackPlot(div, this.iddChart.master);
}
}
@@ -341,7 +359,7 @@ module InteractiveDataDisplay {
if (this.persistentViewState.mapType)
this.bingMapsPlot.setMap(this.persistentViewState.mapType);
else
- this.bingMapsPlot.setMap(Microsoft.Maps.MapTypeId.road);//InteractiveDataDisplay.BingMaps.ESRI.GetWorldShadedRelief());
+ this.bingMapsPlot.setMap(Microsoft.Maps.MapTypeId.road);
this.iddChart.yDataTransform = InteractiveDataDisplay.mercatorTransform;
this.iddChart.xDataTransform = undefined;
} else {
@@ -364,7 +382,7 @@ module InteractiveDataDisplay {
function (id: string, oldPlot: PlotViewerItem, newPlot: PlotViewerItem): PlotViewerItem {
if (oldPlot.Definition.kind == newPlot.Definition.kind) {
if (syncProps(oldPlot.Definition, newPlot.Definition)) // if some properties of new plot are updated
- InteractiveDataDisplay.PlotRegistry[oldPlot.Definition.kind].draw(oldPlot.Plots, oldPlot.Definition);
+ oldPlot.Plots[0].draw(oldPlot.Definition, oldPlot.Definition.titles);
return oldPlot;
}
else { // plot kind is changed
@@ -417,4 +435,4 @@ module InteractiveDataDisplay {
}
}
}
-}
\ No newline at end of file
+}
diff --git a/test/manual/mainGlobal.js b/test/manual/mainGlobal.js
index f2a64011..f7688e8e 100644
--- a/test/manual/mainGlobal.js
+++ b/test/manual/mainGlobal.js
@@ -1,3 +1,4 @@
+///
var main;
(function (main) {
function start() {