VorTechS
Posts: 14
Joined: Thu Dec 16, 2010 9:55 am

Programmatic 'Highlighting' of Series Lines..?

Hi all,

I'm just about done on my coding with highcharts short term obvious bugs withstanding), and it's not been too steep a learning curve (this project has meant delving more into JS than I'm normally used to, and learning about jQuery, jQueryUI and HighCharts)...

I currently am working with this jQuery UI interface, where we display a list of 'things' (trackable web page assets) and show aggregate figures in the chart for each in the multi series chart:

Image

I'm trying to figure out how to programmatically select a line chart to make it stand out from the other lines, and I thought this code should work:

Code: Select all

            
line: {
                states: {
                    select: {
                        enabled: true,
                        linewidth: 3
                    }

Code: Select all

function highlightChartSeries(seriesName) {
    
    // Iterate the available series and select the one we want, and de-select everything else
    for (var seriesCount = 0; seriesCount < chart.series.length; seriesCount++) {
        if (chart.series[seriesCount].name == seriesName) {
            chart.series[seriesCount].selected = true;
        }
        else {
            chart.series[seriesCount].selected = false;
        }
    }
}
But it doesn't appear to. Has anyone successfully managed to do this, or can tell me how I should be doing it?

Thank you! :)
hfrntt
Posts: 6393
Joined: Mon Aug 30, 2010 8:41 am
Contact: Website

Re: Programmatic 'Highlighting' of Series Lines..?

But according to documentation: http://highcharts.com/ref/#plotOptions-series-states series haven't 'selected' state (Just points).
Slawek Kolodziej
Highcharts support team
VorTechS
Posts: 14
Joined: Thu Dec 16, 2010 9:55 am

Re: Programmatic 'Highlighting' of Series Lines..?

Ah okay, that makes sense then.

Where can I raise a feature request for this? (I believe my company is in the process of purchasing appropriate commericial licenses with you!)
hfrntt
Posts: 6393
Joined: Mon Aug 30, 2010 8:41 am
Contact: Website

Re: Programmatic 'Highlighting' of Series Lines..?

Slawek Kolodziej
Highcharts support team
torstein.honsi
Site Admin
Posts: 9215
Joined: Thu Nov 09, 2006 11:22 am
Location: Vik i Sogn, Norway

Re: Programmatic 'Highlighting' of Series Lines..?

Series are selectable, but it isn't reflected in visual options. See http://highcharts.com/ref/#series-object => select.
Torstein Hønsi
CTO, Founder
Highsoft
VorTechS
Posts: 14
Joined: Thu Dec 16, 2010 9:55 am

Re: Programmatic 'Highlighting' of Series Lines..?

Yes, it's the visual representation that is important for us here - so that we can apply visual options to one or more selected series to make them stand out from others in the chart.

For example, our current implementation is this:

Image

Where I have the 'alterian.com' asset selected in my list, I want to make the corresponding line in the chart stand out so that the user can clearly see which line on the chart is represented by the selection.
garrilla
Posts: 98
Joined: Thu Dec 02, 2010 4:02 pm

Re: Programmatic 'Highlighting' of Series Lines..?

If I understood your question right, you could do it with a jQuery

http://jsfiddle.net/EdMXA/2/
VorTechS
Posts: 14
Joined: Thu Dec 16, 2010 9:55 am

Re: Programmatic 'Highlighting' of Series Lines..?

Thanks, I think you understood what I meant (from the fiddle code) but it doesn't appear to work .... ?

** Edit - doesn't appear to work under I.E.
VorTechS
Posts: 14
Joined: Thu Dec 16, 2010 9:55 am

Re: Programmatic 'Highlighting' of Series Lines..?

Ah, I reference the non-minified source and found a solution that works for me:

Code: Select all

chart.series[seriesCount].setState('hover');
This then also preserves the symbol.

Return to “Highcharts Usage”