| Contents > SharpPlot > Methods | Index |
SharpPlot.AddHyperlinks Method
Set up hyperlinks for one or more data points or a chart object.
Example
sp.AddHyperlinks("http://www.grapl.com");
sp.AddHyperlinks(new string[] {"north.aspx","south.aspx"});
Overloads
- public void AddHyperlinks(string links);
- public void AddHyperlinks(string links,int itemNumber);
- public void AddHyperlinks(string links,int itemNumber,string seriesName);
- public void AddHyperlinks(string[] links);
- public void AddHyperlinks(string[] links,string seriesName);
- public void AddHyperlinks(string[][] links);
- public void AddHyperlinks(ScriptTarget targetId,string links);
- public void AddHyperlinks(ScriptTarget targetId,string[] links);
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.AddHyperlinks("boring.aspx",2);
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.aspx. 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:
sp.AddHyperlinks("detail.aspx#July;footnote",7);
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.aspx","South.aspx"});
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.
