0
votes

I have a web site where using Shield UI Javascript I am presenting sales data for authorized visitors. I am in need to add some more functionality – when the user clicks on a point a new window should open displaying the company’s website and eventually supplying a parameter. I am using local data binding like this:

var salesdata = new Array();
salesdata[0]=12.7;
salesdata[1]=11.3;
salesdata[2]=15.4;
salesdata[3]=17.2;
salesdata[4]=18.4;

dataSeries: [{
    seriesType: 'bar',
    collectionAlias: 'chart',
    data: salesdata
}]

I tried different approaches, however I don’t seem to have found the correct one. Basically I can’t find where to store the additional information for each point- the url of the corresponding company. So far I have found there is no place in the chart itself. Any ideas?

1

1 Answers

1
votes

An approach that seems efficient for you would be to declare another array, containing the companies URLs. Since there may or may not be a parameter, you could simply put it in the url:

var  companydata = new Array(); 
companydata[0]="http://www.company_a.com";
companydata[1]="http://www.company_b.com?par=value";
companydata[2]="http://www.company_c.com";
companydata[3]="http://www.company_d.com";
companydata[4]="http://www.company_e.com";
companydata[5]="http://www.company_f.com";

Than you will take use of the seriesClick functionality of the chart:

            events: {
                seriesClick: function(args) {
                    var URL=companydata[args.point.x];
                    var WindowName="Sales Data for point "+args.point.x;
                    window.open(URL, WindowName, "height=200,width=200");
                }
            },

opening a new window for the point’s corresponding url. Additionally you may adjust the window size depending on the company and so on.