cancel
Showing results for 
Search instead for 
Did you mean: 

x- Axis Label of Selected Bar

Former Member
0 Kudos

Hi,

I want to capture x -Axis Label for the selected bar in a group bar chart.

I tried several ways but no luck.

I am trying in this way.

In display template I placed two columns DATE and TYPE.

alert(document.qual_barchart.getChartObject().getDatalinkValue(document.qual_barchart.getChartObject().getSelectedPen(),document.qual_barchart.getChartObject().getLastSelectedPoint(),2));

I want to capture datalink value of TYPE column of user selected bar.

Can I get any help in this regard.

Thanks,

Srinivas.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Did you link DATE and TYPE in the "Datalink Columns" field on the Data Mapping tab of the chart template?

Former Member
0 Kudos

Ryan,

Yes, I placed these two in Datalink Columns.

Thanks for showing up on this.

Srinivas.

jcgood25
Active Contributor
0 Kudos

Srinivas,

In JavaScript alert is your friend...


var myChart = document.qual_barchart.getChartObject();
var mySelPen = myChart.getLastSelectedTag();
var mySelPenName = myChart.getTagName(mySelPen);
var mySelPoint = myChart.getLastSelectedPoint();
var mySelDLValue = myChart.getDatalinkValue(mySelPen,mySelPoint,2);
alert("Pen: " + mySelPen + "rPenName: " + mySelPenName + "rPoint: " + mySelPoint + "rDL Value: " + mySelDLValue);

Best Regards,

Jeremy Good

jcgood25
Active Contributor
0 Kudos

The .getSelectedPen() method you were using returns the one selected in the Chart Legend (not the 'last' one selected in the chart area which is the .getLastSelectedTag() method).

Former Member
0 Kudos

Jeremy,

I misread help documentation. Your code helped me to understand the mistake I was doing with pen.

Thanks,

Srinivas.

Answers (0)