Is it possible to create a custom legend on a bar graph? | Discussions

Expand all | Collapse all

Is it possible to create a custom legend on a bar graph?

  • 1.  Is it possible to create a custom legend on a bar graph?

    Posted 07-10-2017 15:22
    The legend description is automatic, but because I'm filtering the data - I want to put specific text in the legend to help the users understand what they are looking at. Is it possible to create your own legends?


  • 2.  RE: Is it possible to create a custom legend on a bar graph?

    Top
    Contributor
    Posted 07-10-2017 15:46
    I know you can change the colors, but I don't think you can change the text because it is based on the series you select. 

    I'd recommend using a chart "description" and show that on the report.  
    Descriptive axis labels help, and chart titles as well to tell the whole story.


  • 3.  RE: Is it possible to create a custom legend on a bar graph?

    Posted 07-10-2017 15:50
    thanks Matt. I have that setup now but was hoping we could do a bit more because our graph trends are bit complex because we are comparing things that aren't similar. 


  • 4.  RE: Is it possible to create a custom legend on a bar graph?

    Top
    Contributor
    Posted 07-10-2017 16:03
    Using script you can modify a QuickBase rendered chart an change any options including the legend. Here are two examples that (1) changed the Yaxis and (2) change the data to cumulative:

    https://haversineconsulting.quickbase.com/db/bk89redf6?a=q&qid=1

    The key to doing this is (1) to get a programmatic handle to the chart, (2) extract the current options, (3) destroy the current chart, (4) modify the original chart's options, and (5) redraw the chart with the new options:
    var chart = Highcharts.charts[0];
    var options = chart.options;
    chart.destroy();
    options.yAxis[0].min = 0;
    options.yAxis[0].max = 80;
    new Highcharts.Chart(options);
    In the above examples I am animating the full process from a tasks table. However, if you embed a chart in a report the process can be made seamless so only the final chart appears.