Welcome and thank you for joining our new OpenText forum. Your questions, responses, best practices, and tips shared with other members will help make this channel vibrant. We're glad you're joining us and look forward to collaborating with you online.

Check out the Getting Started With OpenText Forums for tips on personalizing your experience.

How to Hide Series 2 Legend in the Chart

Hi


I have a report where I have two series Bar and line in the same chart. I'm showing total count against each application for the last 7 weeks.

 

The first 3 application names,we are showing in bar chart and the last 3 application names in line series like below.

 

//bar series

if (dataSetRow["Application"] == 'A1')

{

 row["Count"]

}

else if (dataSetRow["Application"] == 'A2')

{

 row["Count"]

}

else if (dataSetRow["Application"] == 'A3')

{

 row["Count"]

}

 

//line series

if (dataSetRow["Application"] == 'A4')

{

 row["Count"]

}

else if (dataSetRow["Application"] == 'A5')

{

 row["Count"]

}

else if (dataSetRow["Application"] == 'A6')

{

 row["Count"]

}

 

But the legend values are showing for all the application names as below

Series 1 - A1

Series 1 - A2

Series 1 - A3

Series 1 - A4

Series 1 - A5

Series 1 - A6

 

Series 2 - A1

Series 2 - A2

Series 2 - A3

Series 2 - A4

Series 2 - A5

Series 2 - A6

 

I want series 1 to display only the first 3 application names and series 2 to display only the last 3 applications.

 

Please help if anyone has worked on the above scenario.

Comments

  • Hi,


     


    what version of BIRT are you using ?


    Can you upload a flat file (csv) with basic sample datas ?


    Guillaume L.
    Solution Consultant
    OpenText Reporting & Analytics
    http://www.opentext.com
  • edited March 16, 2016


    Hi,


     


    what version of BIRT are you using ?


    Can you upload a flat file (csv) with basic sample datas ?




    Hi GLO_FR


     


    The release version of BIRT Actuate is Version : 4.4.0


     I have attached the output ,report the excel datasource. Please help if you know how to show the corresponding legend values based on the Y series.


     


    I have written the code for each series as below,


    //line series


    if (dataSetRow["Application"] == 'App_01')

    {

     row["Count"]

    }

    else if (dataSetRow["Application"] == 'App_02')

    {

     row["Count"]

    }

    else if (dataSetRow["Application"] == 'App_03')

    {

     row["Count"]

    }


     


     //bar series


    if (dataSetRow["Application"] == 'App_04')

    {

     row["Count"]

    }

    else if (dataSetRow["Application"] == 'App_05')

    {

     row["Count"]

    }

    else if (dataSetRow["Application"] == 'App_06')

    {

     row["Count"]

    }


     


    But the data for the remaining apps are showing in the line series as 0. but i want only 3 apps to be shown in line and the other 3 in bar.


     


    I have also tried having a seperate total number column for both BAR and LINE as below


     


    if (row["Count_Bar"] != null) { row["Count_Bar"];}


     


     


    if(row["Count_Line"] != null) { row["Count_Line"];}


     


    Kindly help if you know how to limit the entries for each chart. I guess the problem lies here since all the apps are showing for both the series, the legends are displaying all. If we could change the above logic, the issue will be resolved.


     


    Kindly help if anyone has written any script to hide the zero values in the series.


  • Hi,


     


    the easiest way can be to simply add some script to hide the serie.



    beforeRendering: function(options, chart) {
    for (i=0;i<options.series.length; i++) {
    if (i<3 || i>8) {
    options.series[i].showInLegend = true;
    } else {
    options.series[i].showInLegend = false;
    }
    }

    example attached


     


     


    Guillaume L.
    Solution Consultant
    OpenText Reporting & Analytics
    http://www.opentext.com


  • Hi,


     


    the easiest way can be to simply add some script to hide the serie.



    beforeRendering: function(options, chart) {
    for (i=0;i<options.series.length; i++) {
    if (i<3 || i>8) {
    options.series[i].showInLegend = true;
    } else {
    options.series[i].showInLegend = false;
    }
    }

    example attached




    Thanks


     


    But the main issue we found in the report now is the list of values showing for each charts.


     


    I want only APP_01,APP_02,APP_03 to show as line series and APP_04,APP_05,APP_06 as Bar.


     


    Attached the report and the excel source.


     


    The error is all the apps are showing in the Bar and line with values as zero.



  • Hi,


     


    the easiest way can be to simply add some script to hide the serie.



    beforeRendering: function(options, chart) {
    for (i=0;i<options.series.length; i++) {
    if (i<3 || i>8) {
    options.series[i].showInLegend = true;
    } else {
    options.series[i].showInLegend = false;
    }
    }

    example attached




    Thanks a ton.


    The above solution worked with our excel datasource.


     


    But we actually use JDBC data source, the script column in the chart doesnt show any functions. Is it because of the data source? kindly help

  • Mmmm strange. 


    In the Chart wizard window, did you choose HTML5 chart on the "Select Chart type" sheet

    Guillaume L.
    Solution Consultant
    OpenText Reporting & Analytics
    http://www.opentext.com
  • You can also do it that way (serie renamed dynamicaly with script).


    In that case no "ghost" series with 0/null value


     


    Guillaume L.
    Solution Consultant
    OpenText Reporting & Analytics
    http://www.opentext.com


  • Mmmm strange. 


    In the Chart wizard window, did you choose HTML5 chart on the "Select Chart type" sheet




    I also faced the similar issue. The chart type selected was "HTML5". but no script function can be written inside the chart script editor.


    Instead wrote the script in the main page script editor but it didnt render the desired results. could we test/debug how the script works?

  • Guillaume L.
    Solution Consultant
    OpenText Reporting & Analytics
    http://www.opentext.com


  • You can also do it that way (serie renamed dynamicaly with script).


    In that case no "ghost" series with 0/null value




    Hi Guillaume


     


    I have a similar requirement but in your example you have used incremental logic to the series since it is increasing with numbers.


     


    But my scenario is little different, I have the series as string values and I want to show first 2 in Bar and the remaining in Line.


     


    I have attached the flat file and the same barchart you have modified. Kindly help.

Sign In or Register to comment.