SharpPlot Reference > SharpPlot Methods > AddHyperlinks Method

SharpPlot.AddHyperlinks Method

Set up hyperlinks for one or more data points or a chart object.


sp.AddHyperlinks(new string[] {"north.htm","south.htm"});


This method is used to make ‘active’ graphics work on your web site. It allows you to associate any URL (typically the address of another page on your site) with a data point on the chart. You may define the jump explicitly by data item, giving the index of the data point in the series, and the target URL. For example:

sp.DrawPieChart(New int[] {3,2,1});

The second pie slice will show a ‘pointing hand’ in the web browser and when clicked it will route you to the page ‘boring.htm’. To jump to an anchor within the target page add ‘#anchor’ to the tag as usual. To route the jump to a specific frame, add the frame id to the URL, separated with a semi-colon:


This would be a good way to allow the user to click on the datapoints of a timeseries and see a summary of the numeric information for that datapoint in a second frame below the chart.

Setting up multiple links

If you have a target page for every datapoint, you can omit the item information entirely and simply supply an array of strings, shaped to match your data exactly.

sp.AddHyperlinks(new string[] {"North.htm","South.htm"});

This is probably the commonest call to this method, as the array of target pages could be read from a database in the same query as you use to obtain the values.

See also ...

SharpPlot Members

Send comments on this topic
© Dyalog Ltd 2021