Hi,
I have a form with two chart surfaces each displaying a chart. I have set their visible ranges to be the same but they have different Y Axis values. This causes the YAxis not to line up. Is there a way I can have the YAxis of both surfaces line up. I’m trying to sync both surfaces and am using the MouseManager.MouseEventGroup to do it. I set the Chart modifiers for the top chart in xaml like this:
<s:SciChartSurface.ChartModifier>
<s:ModifierGroup s:MouseManager.MouseEventGroup="MyCustomGroup">
<s:AnnotationCreationModifier x:Name="annotationCreation" AnnotationCreated="OnAnnotationCreated" YAxisId="Y1"/>
<s:XAxisDragModifier ClipModeX="None" />
<s:YAxisDragModifier IsEnabled="True" ReceiveHandledEvents="True" AxisId="Y1"/>
<s:ZoomPanModifier IsEnabled="True" ReceiveHandledEvents="True" />
<s:CursorModifier IsEnabled="{Binding ShowCursor}" ShowAxisLabels="False" ShowTooltip="True" ReceiveHandledEvents="True" />
<s:MouseWheelZoomModifier ReceiveHandledEvents="True" />
<s:ZoomExtentsModifier ExecuteOn="MouseDoubleClick" />
</s:ModifierGroup>
</s:SciChartSurface.ChartModifier>
and the bottom chart is created in the view model like this:
var scs = new SciChartSurface();
scs.XAxis = new CategoryDateTimeAxis() { DrawMajorGridLines = false, DrawMinorGridLines = false, AutoRange = AutoRange.Never,VisibleRange = ChartVisibleRange};
scs.YAxis = new NumericAxis() { Id = "Y1", DrawMajorGridLines=false,DrawMinorGridLines=false };
scs.Style = (System.Windows.Style)this.chartForm.sciChartControl.Resources["SciChartSurfaceStyle"];
SciChartGroup.SetVerticalChartGroup(scs, "myGroup");
var _chartModifiers = new ModifierGroup();
MouseManager.SetMouseEventGroup(_chartModifiers, "MyCustomGroup");
ChartModifierBase[] chmodColl = this.GetDefaultChartModifiers();
foreach (ChartModifierBase chmod in chmodColl)
{
_chartModifiers.ChildModifiers.Add(chmod);
}
scs.ChartModifier = _chartModifiers;
and the function returning chartmodifiers returns
private ChartModifierBase[] GetDefaultChartModifiers()
{
var chartModifiers = new ChartModifierBase[7];
XAxisDragModifier xAxisModifier = new XAxisDragModifier();
xAxisModifier.ClipModeX = ClipMode.None;
ZoomPanModifier zModifier = new ZoomPanModifier();
zModifier.IsEnabled = true;
zModifier.ReceiveHandledEvents = true;
MouseWheelZoomModifier mwzoom = new MouseWheelZoomModifier();
mwzoom.ReceiveHandledEvents = true;
ZoomExtentsModifier zEModifier = new ZoomExtentsModifier();
zEModifier.ExecuteOn = ExecuteOn.MouseDoubleClick;
CursorModifier curModifier = new CursorModifier();
curModifier.IsEnabled = false;
curModifier.ShowAxisLabels = true;
curModifier.ShowTooltip = false;
curModifier.ReceiveHandledEvents = true;
SeriesValueModifier serModifier = new SeriesValueModifier();
//serModifier.YAxisId = "Y1";
serModifier.IsEnabled = true;
AnnotationCreationModifier annoModifier = new AnnotationCreationModifier();
annoModifier.YAxisId = "Y1";
annoModifier.IsEnabled = true;
annoModifier.AnnotationCreated += annoModifier_AnnotationCreated;
chartModifiers[0] = xAxisModifier;
chartModifiers[1] = zModifier;
chartModifiers[2] = mwzoom;
chartModifiers[3] = zEModifier;
chartModifiers[4] = curModifier;
chartModifiers[5] = annoModifier;
chartModifiers[6] = serModifier;
return chartModifiers;
}
The problem is both the charts don’t seem to be synchronised. When I zoom/pan the top chart, nothing happens in the MACD chart and vice versa. What am I doing wrong here ?
I have attached a screenshot of my application. Thanks for patiently answering all my queries so far, you guys are awesome.
- deepakb1 asked 10 years ago
- You must login to post comments
I am considering applying server-side licensing for my javerScript application.
In the document below, there is a phrase “Our server-side licensing component is written in C++.”
(https://support.scichart.com/index.php?/Knowledgebase/Article/View/17256/42/)
However, there is only asp.net sample code on the provided github.
(https://github.com/ABTSoftware/SciChart.JS.Examples/tree/master/Sandbox/demo-dotnet-server-licensing)
I wonder if there is a sample code implemented in C++ for server-side licensing.
Can you provide c++ sample code?
Also, are there any examples to run on Ubuntu?
- Andrew Burnett-Thompson answered 10 years ago
-
Hey by the way, you should consider using BandSeries for the MACD with semi-transparent band colors - as then you can get a shaded polygon between the two lines which changes colour depending on whether the MACD signal line is above/below the other. Best regards, Andrew
-
Thanks Andrew, that worked like a charm. I will look into the BandSeries as well. Deepak
- You must login to post comments
Please login first to submit.