ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Hotspot events on FinanceChart (WinChart)
Posted by Daniel on Jan-21-2017 01:31
I am able to detect hotspot events on the FinanceChart and then I am able to set the width of the line to be larger.  However I am unable to find a way to do it for Indicator addons (e.g. RSI, ACCDist, WilliamR, etc). Is there a way to do it?

As an example, I am currently doing this for the main chart (XYChart):

    XYChart main = m.addMainChart(mainHeight);
    ...
    Layer layer = main.getLayer(highlight);
    layer.moveFront();
    layer.setLineWidth(3);

Thanks

  Re: Hotspot events on FinanceChart (WinChart)
Posted by Peter Kwan on Jan-21-2017 05:04
Hi Daniel,

When you add the indicator chart, it will return an XYChart object.

From the XYChart object, you can determine the layers using XYChart.getLayer, and then you can determine the data sets using Layer.getDataSet, and determine the name of the data set. When the user clicks on a line, the query parameters should include (or can be configured to include) the data set name. You can use it to determine which line the user has clicked and highlight it.

Hope this can help.

Regards
Peter Kwan

  Re: Hotspot events on FinanceChart (WinChart)
Posted by Daniel on Jan-21-2017 05:08
Works! Thank you for the quick response.

  Re: Hotspot events on FinanceChart (WinChart)
Posted by Daniel on Jan-21-2017 05:30
Just noticed that when there are multiple indicators on the same FinanceChart, the id for each layer on their respective XYChart is set to 0. How can I differentiate between the multiple indicators, maybe manually setting their ids?

  Re: Hotspot events on FinanceChart (WinChart)
Posted by Peter Kwan on Jan-21-2017 12:34
Attachments:
Hi Daniel,

The attached screenshot shows the default parameters include in the WinHotSpotEventArgs. I get this by using the ParamViewer Form in the original NetWinCharts sample code as follows:

private void winChartViewer1_ClickHotSpot(object sender, WinHotSpotEventArgs e)
{
     new ParamViewer().Display(sender, e);
}

I am not too sure which "id" you are referring to. The dataSet number in the parameters are usually 0, which just reflects the data set is the first data set in a layer. May be the layer just contain 1 data set.

As mentioned in my last message, you may identify which layer and which dataset the user has clicked by using the "dataSetName". To do this, just iterate the layers and data sets to find one that matches the "dataSetName".

If you would like to have the layerId included in the WinHotSpotEventArgs, you may specify the parameters you want to be included using the second parameter to getHTMLImageMap, like:

//include the {layerId} and {dataSet} number in WinHotSpotEventArgs
viewer.ImageMap = m.getHTMLImageMap("clickable", "layer={layerId}&dataSet={dataSet}", "title='" + m.getToolTipDateFormat() + " {value|P}'");

You may refer to the following page on all available parameters:

http://www.advsofteng.com/doc/cdnet.htm#paramsub.htm

Hope this can help.

Regards
Peter Kwan
parameters.png