ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  How to get {dataGroupName} parameter
Posted by April on Apr-28-2011 10:14
Hi Peter,


I can manage to pass {dataSetName} value but not able to pass {dataGroupName} . How can i get the {dataGroupName} value ? Because i have two data groups combine in one chart.. so when user click on bar chart..i need to know what datagroup they are clicking and i will generate new chart base on this value. below is my code. Thanks for helping me all my questions and really appreciated.

   //XYChart c = new XYChart(560, 280);
        XYChart c = new XYChart(700, 360);
        // Add a title to the chart using 14 pts Arial Bold Italic font
       c.addTitle(ShowCode + " (24 Months Period) Total Sale Report " + ShowYear + " vs " + ShowYear1, "Arial Bold Italic", 13);

        // Set the plotarea at (50, 50) and of 500 x 200 pixels in size. Use alternating
        // light grey (f8f8f8) / white (ffffff) background. Set border to transparent and
        // use grey (CCCCCC) dotted lines as horizontal and vertical grid lines
        c.setPlotArea(70, 60, 500, 255, 0xffffff, 0xf8f8f8, Chart.Transparent,
            c.dashLineColor(0xcccccc, Chart.DotLine), c.dashLineColor(0xcccccc,
            Chart.DotLine));

        // Add a legend box at (50, 22) using horizontal layout. Use 10 pt Arial Bold
        // Italic font, with transparent background

        // c.addLegend(50, 22, False, "Arial Bold Italic", 10).setBackground( _
        //Chart.Transparent)


        LegendBox legendBox = c.addLegend(600, 180);
        //legendBox.setAlignment(Chart.TopCenter);

        legendBox.setText("{dataSetName} {dataGroupName}");
        legendBox.setBackground(Chart.Transparent);


        // Set the x axis labels
        c.xAxis().setLabels(labels);
        c.xAxis().setTitle("Months", "Arial Bold", 10);

        // Draw the ticks between label positions (instead of at label positions)
        c.xAxis().setTickOffset(0.5);

        // Add axis title
        c.yAxis().setTitle("Total SOLD");
       // c.yAxis().setTitle("Total SOLD");

        // Set axis line width to 2 pixels
        c.xAxis().setWidth(2);
        c.yAxis().setWidth(2);

        // Add a multi-bar layer with 3 data sets
        BarLayer layer = c.addBarLayer2(Chart.Side);
        layer.addDataGroup(ShowYear);
        layer.addDataSet(data, 0xff0000, ShowCode);
        // Enable bar label for the whole bar
        // layer.setAggregateLabelStyle();
        layer.addDataGroup(ShowYear1);
        layer.addDataSet(data1, 0x00ff00a, ShowCode);
        //layer.addDataSet(data3, 0xff6666, ShowYear1);
        //layer.addExtraField2(Past);
        //layer.addExtraField2(CurrentRptYear_select);
        // Set bar shape to circular (cylinder)
        layer.setBarShape(Chart.CircleShape);


        // Configure the bars within a group to touch each others (no gap)
        layer.setBarGap(0.2, Chart.TouchBar);

        // Output the chart
        WebChartViewer1.Image = c.makeWebImage(Chart.PNG);

        //WebChartViewer1.ImageMap = c.getHTMLImageMap("", "",
        //    "title='{dataSetName} {dataGroupName} on {xLabel} $:{value}'");

        WebChartViewer1.ImageMap = c.getHTMLImageMap("AllSalePersons.aspx?year=" +
      ddlShowYear + "&showcode=" + ddlShowCode, "",
          "title='{dataSetName} {dataGroupName} on {xLabel} $:{value}'");


from the code behind

        int selectedYear = int.Parse(Request["year"]);
        string year = Request["dataSetName"];
        string year1 = Request["dataGroupName"];// i cant get this value

        string code = Request["showcode"];

        int selectedMonth = int.Parse(Request["x"]) + 1;

  Re: How to get {dataGroupName} parameter
Posted by Peter Kwan on Apr-28-2011 14:45
Hi April,

The default query parameters do not include the data group name. (The documentation on BaseChart.getHTMLImageMap lists out which parameters are included by default.)

To include the data group name, you would need to include it in the getHTMLImageMap method call. For example:

WebChartViewer1.ImageMap = c.getHTMLImageMap("AllSalePersons.aspx?dataGroupName={dataGroupName}&year=" + ddlShowYear + "&showcode=" + ddlShowCode, "", "title='{dataSetName} {dataGroupName} on {xLabel} $:{value}'");

Hope this can help.

Regards
Peter Kwan

  Re: How to get {dataGroupName} parameter
Posted by April on Apr-28-2011 14:51
Thank you so much Peter.It work 100% and get the value. Have a nice day.