Skip to content

Commit 04b9e43

Browse files
committed
Adds AMCHART BALLOON with same output formatting as HPCC Charts
Signed-off-by: Mathew Zummo <[email protected]>
1 parent 777da35 commit 04b9e43

15 files changed

+28
-24
lines changed

src/amchart/Area.js

-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
Area.prototype.publish("paletteID", "default", "set", "Palette ID", Area.prototype._palette.switch(),{tags:["Basic","Shared"]});
2020
Area.prototype.publish("isStacked", false, "boolean", "Stack Chart",null,{tags:["Basic","Shared"]});
2121
Area.prototype.publish("fillOpacity", 0.7, "number", "Opacity of The Fill Color", null, {min:0,max:1,step:0.001,inputType:"range",tags:["Intermediate","Shared"]});
22-
23-
Area.prototype.publish("tooltipTemplate","[[category]]: [[value]]", "string", "Tooltip Text",null,{tags:["Intermediate"]});
2422
Area.prototype.publish("stackType", "regular", "set", "Stack Type",["none","regular","100%"],{tags:["Basic"]});
2523

2624
Area.prototype.enter = function(domNode, element) {

src/amchart/Bar.js

-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232

3333
Bar.prototype.publish("stackType", "regular", "set", "Stack Type",["none","regular","100%"],{tags:["Basic"]});
3434

35-
Bar.prototype.publish("tooltipTemplate","[[category]]([[title]]): [[value]]", "string", "Tooltip Text",null,{tags:["Intermediate"]});
36-
3735
Bar.prototype.enter = function(domNode, element) {
3836
CommonSerial.prototype.enter.apply(this, arguments);
3937
};

src/amchart/Bubble.js

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
Bubble.prototype.implements(INDChart.prototype);
2020

2121
Bubble.prototype.publish("paletteID", "default", "set", "Palette ID", Bubble.prototype._palette.switch(), {tags:["Basic","Shared"]});
22-
Bubble.prototype.publish("tooltipTemplate","x:[[x]] y:[[y]]", "string", "Tooltip Text");
2322

2423
Bubble.prototype.enter = function(domNode, element) {
2524
CommonXY.prototype.enter.apply(this, arguments);

src/amchart/Candle.js

-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222

2323
Candle.prototype.publish("paletteGrouping", "By Column", "set", "Palette Grouping",["By Category","By Column"],{tags:["Basic"]});
2424

25-
Candle.prototype.publish("tooltipTemplate",'<div style="text-align:left;"><b>[[category]]</b><br/> Open:<b>[[open]]</b> Close:<b>[[close]]</b><br/>Low:<b>[[low]]</b> High:<b>[[high]]</b></div>', "string", "Tooltip Text",null,{tags:["Intermediate"]});
26-
2725
Candle.prototype.publish("columnWidth", 0.62, "number", "Bar Width",null,{tags:["Basic"]});
2826

2927
Candle.prototype.publish("stackType", "regular", "set", "Stack Type",["none","regular","100%"],{tags:["Basic"]});

src/amchart/CommonRadar.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,10 @@
133133
var context = this;
134134
var gObj = {};
135135

136-
gObj.balloonText = context.tooltipTemplate();
136+
gObj.balloonFunction = function(d) {
137+
var balloonText = d.category + ", " + context.columns()[d.graph.index+1] + ": " + context.data()[d.index][d.graph.columnIndex+1];
138+
return balloonText;
139+
}
137140
gObj.fillAlphas = context.fillOpacity();
138141
gObj.lineAlpha = context.lineOpacity();
139142
gObj.lineThickness = context.lineWidth();

src/amchart/CommonSerial.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@
99
}(this, function(d3, HTMLWidget, AmCharts, require) {
1010
function CommonSerial() {
1111
HTMLWidget.call(this);
12+
ITooltip.call(this);
1213
this._tag = "div";
1314

1415
this._chart = {};
1516
}
1617
CommonSerial.prototype = Object.create(HTMLWidget.prototype);
18+
1719
CommonSerial.prototype.constructor = CommonSerial;
1820
CommonSerial.prototype._class += " amchart_CommonSerial";
1921

@@ -163,7 +165,10 @@
163165
var context = this;
164166
var gObj = {};
165167

166-
gObj.balloonText = context.tooltipTemplate();
168+
gObj.balloonFunction = function(d) {
169+
var balloonText = d.category + ", " + context.columns()[d.graph.columnIndex+1] + ": " + context.data()[d.index][d.graph.columnIndex+1];
170+
return balloonText;
171+
}
167172
gObj.lineAlpha = context.lineOpacity();
168173
gObj.lineColor = context.lineColor();
169174
gObj.lineThickness = context.lineWidth();
@@ -241,6 +246,9 @@
241246
this._chart.addListener("clickGraphItem", function(e) {
242247
context.click(context.rowToObj(context._data[e.index]), context._columns[e.target.columnIndex+1]);
243248
});
249+
this._chart.addListener("rollOverGraphItem", function(e) {
250+
context.tooltipShow(context.rowToObj(context._data[e.index]), context._columns, e.target.columnIndex+1);
251+
});
244252
};
245253

246254
CommonSerial.prototype.update = function(domNode, element) {

src/amchart/CommonXY.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,10 @@
154154
var context = this;
155155
var gObj = {};
156156

157-
gObj.balloonText = context.tooltipTemplate();
157+
gObj.balloonFunction = function(d) {
158+
var balloonText = context.columns()[d.graph.columnIndex+1] + ": " + context.data()[d.index][d.graph.columnIndex+1];
159+
return balloonText;
160+
}
158161
gObj.lineAlpha = context.lineOpacity();
159162
gObj.lineThickness = context.lineWidth();
160163
gObj.bullet = context.bulletType();

src/amchart/FloatingColumn.js

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
FloatingColumn.prototype.publish("Angle3D", 0, "number", "3D Angle (Deg)",null,{tags:["Basic"]});
3030

3131
FloatingColumn.prototype.publish("stackType", "regular", "set", "Stack Type",["none","regular","100%"],{tags:["Basic"]});
32-
FloatingColumn.prototype.publish("tooltipTemplate","[[category]]([[title]]): [[value]]", "string", "Tooltip Text",null,{tags:["Intermediate"]});
3332

3433
FloatingColumn.prototype.testData = function() {
3534
this.columns(["Subject", "open", "close"]);

src/amchart/Funnel.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@
1919
Funnel.prototype.publish("neckHeightPercent", 30, "number", "Neck Height %",null,{tags:["Basic"]});
2020
Funnel.prototype.publish("neckWidthPercent", 40, "number", "Neck Width %",null,{tags:["Basic"]});
2121

22-
//TODO
23-
Funnel.prototype.publish("tooltipTemplate","[[category]]([[title]]): [[value]]", "string", "Tooltip Text",null,{tags:["Basic"]});
24-
2522
Funnel.prototype.enter = function(domNode, element) {
2623
CommonFunnel.prototype.enter.apply(this, arguments);
2724
};
2825

2926
Funnel.prototype.updateChartOptions = function() {
3027
CommonFunnel.prototype.updateChartOptions.apply(this, arguments);
3128

32-
this._chart.balloonText = this.tooltipTemplate();
29+
this._chart.balloonFunction = function(d) {
30+
var balloonText = d.title + ", " + d.value;
31+
return balloonText;
32+
}
3333
this._chart.neckHeight = this.neckHeightPercent()+"%";
3434
this._chart.neckWidth = this.neckWidthPercent()+"%";
3535
};

src/amchart/Line.js

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
Line.prototype.publish("smoothLines", false, "boolean", "Causes chart data lines to draw smoothly",null,{tags:["Basic","Shared"]});
2121

2222
Line.prototype.publish("stepLines", false, "boolean", "Causes chart data lines to draw smoothly",null,{tags:["Basic"]});
23-
Line.prototype.publish("tooltipTemplate","[[category]]([[title]]): [[value]]", "string", "Tooltip Text",null,{tags:["Basic"]});
2423

2524
Line.prototype.enter = function(domNode, element) {
2625
CommonSerial.prototype.enter.apply(this, arguments);

src/amchart/Pie.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
Pie.prototype.publish("fontSize", 11, "number", "Label Font Size",null,{tags:["Basic","Shared"]});
2222
Pie.prototype.publish("fontColor", null, "html-color", "Label Font Color",null,{tags:["Basic","Shared"]});
2323

24-
Pie.prototype.publish("tooltipTemplate","[[title]]<br><span style='font-size:14px'><b>[[value]]</b> ([[percents]]%)</span>", "string", "Tooltip Text",null,{tags:["Intermediate"]});
25-
2624
Pie.prototype.publish("Depth3D", 0, "number", "3D Depth (px)",null,{tags:["Basic"]});
2725
Pie.prototype.publish("Angle3D", 0, "number", "3D Angle (Deg)",null,{tags:["Basic"]});
2826

@@ -48,8 +46,10 @@
4846
this._chart.type = "pie";
4947
this._chart.radius = this.radius();
5048

51-
this._chart.balloonText = context.tooltipTemplate();
52-
49+
this._chart.balloonFunction = function(d) {
50+
var balloonText = d.title + ", " + d.value;
51+
return balloonText;
52+
}
5353
this._chart.labelPosition = this.labelPosition();
5454

5555
if (this.marginLeft()) { this._chart.marginLeft = this.marginLeft(); }
@@ -65,6 +65,8 @@
6565
this._chart.fontSize = this.fontSize();
6666
this._chart.color = this.fontColor();
6767

68+
69+
this._chart.outlineColor = "#000000";
6870
this._chart.allLabels = [];
6971
this._chart.pieAlpha = this.pieAlpha();
7072

src/amchart/Polar.js

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
Polar.prototype.implements(INDChart.prototype);
1818

1919
Polar.prototype.publish("paletteID", "default", "set", "Palette ID", Polar.prototype._palette.switch(), {tags:["Basic","Shared"]});
20-
Polar.prototype.publish("tooltipTemplate","[[category]]([[title]]): [[value]]", "string", "Tooltip Text",null,{tags:["Intermediate"]});
2120

2221
Polar.prototype.testData = function() {
2322
this.columns(["Subject", "Year 1", "Year 2", "Year 3", "Year 4"]);

src/amchart/Pyramid.js

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
Pyramid.prototype.implements(I2DChart.prototype);
1818

1919
Pyramid.prototype.publish("paletteID", "default", "set", "Palette ID", Pyramid.prototype._palette.switch(), {tags:["Basic","Shared"]});
20-
Pyramid.prototype.publish("tooltipTemplate","[[category]]([[title]]): [[value]]", "string", "Tooltip Text",null,{tags:["Intermediate"]});
2120

2221
Pyramid.prototype.testData = function() {
2322
this.columns(["Subject", "Year 1"]);

src/amchart/Scatter.js

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
Scatter.prototype.implements(INDChart.prototype);
2020

2121
Scatter.prototype.publish("paletteID", "default", "set", "Palette ID", Scatter.prototype._palette.switch(), {tags:["Basic","Shared"]});
22-
Scatter.prototype.publish("tooltipTemplate","x:[[x]] y:[[y]]", "string", "Tooltip Text");
2322

2423
Scatter.prototype.enter = function(domNode, element) {
2524
CommonXY.prototype.enter.apply(this, arguments);

src/common/HTMLWidget.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,4 +187,4 @@
187187
};
188188

189189
return HTMLWidget;
190-
}));
190+
}));

0 commit comments

Comments
 (0)