我正在将 scichart 集成到我的 android 项目中并面临此错误。我需要显示 ohlc 数据,因此基于本教程https://www.scichart.com/example/android-candlestick-chart-example/我写道
val dataSeries = OhlcDataSeries(Date::class.java, Double::class.java)
Run Code Online (Sandbox Code Playgroud)
那是从java代码翻译过来的
IOhlcDataSeries<Date, Double> dataSeries = new OhlcDataSeries<>(Date.class, Double.class);
Run Code Online (Sandbox Code Playgroud)
我收到这个错误
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.qh.cointracker, PID: 5275
java.util.NoSuchElementException: GenericClass doesn't support Class<double>
at com.scichart.data.numerics.math.GenericMathFactory.create(GenericMathFactory.java:65)
at com.scichart.charting.model.dataSeries.DataSeries.<init>(DataSeries.java:91)
at com.scichart.charting.model.dataSeries.XDataSeries.<init>(XDataSeries.java:58)
at com.scichart.charting.model.dataSeries.OhlcDataSeries.<init>(OhlcDataSeries.java:58)
at com.scichart.charting.model.dataSeries.OhlcDataSeries.<init>(OhlcDataSeries.java:73)
at com.qh.cointracker.activities.fragments.SymbolChartFragment.initExample(SymbolChartFragment.kt:57)
at com.qh.cointracker.activities.fragments.SymbolChartFragment.onViewCreated(SymbolChartFragment.kt:37)
Run Code Online (Sandbox Code Playgroud)
有人能给我解决这个错误的任何想法吗
谢谢你。
我有一个 TabControl,它通过 ItemsControl 包含动态数量的图表窗格。ItemsControl\xe2\x80\x99s ItemsTemplate 内部是一个单独的 ScichartSurface,它绑定到 RenderableSeries、XAxis、YAxes 和 VerticalChartGroup。
\n\nxaml 看起来像这样:
\n\n<s:SciChartSurface name="Chart" RenderableSeries="{Binding rSeries}" XAxis="{Binding xAxis}" YAxes="{Binding yAxes}" s:SciChartGroup.VerticalChartGroup="{Binding vGroup}">\nRun Code Online (Sandbox Code Playgroud)\n\n在表面内,我有一个 ModifierGroup,其中包含(按顺序)RubberbandXyZoomModifier (XAxisOnly)、MouseWheelZoomModifier、ZoomPanModifier、ZoomExtentsModifier 和自定义 mod 调用 TimeSegmentSelectionModifier。所有这些修饰符的 ReceiveHandledEvents 属性都设置为 True,它们都在同一个 MouseEventGroup 下,并且在正常情况下它们似乎都工作正常。
\n\n注意:Rubberband 和 TimeSegment 修改器相反地设置为“启用”。这意味着,一次只有其中一个起作用。
\n\n我的问题主要是与 RubberBand Mod 相关:
\n\n让\xe2\x80\x99s 说我有 5 个图表窗格正在显示,并且我想要放大;如果我在第三个图表中单击并拖动,每个图表都会正确缩放。\n如果我在第三个图表中单击,将鼠标拖动到该图表之外(屏幕上的任何其他位置)并松开,则只有图表 1、2 和3 缩放正确。图 4 和图 5 不会\xe2\x80\x99t 移动,就好像我只是缩放到一定程度一样。
\n\n任意数量的图表窗格都会发生这种情况,并且问题会发生在我碰巧放大的任何窗格上。
\n\n我\xe2\x80\x99 几天来一直在解决这个问题,但我不\xe2\x80\x99 不知道还能去哪里寻找。\n非常感谢任何帮助。
\n我在ViewModel的图形模型中有一个DispatcherTimer,用于定期更新(滚动)它。
最近,我发现这是一个巨大的资源泄漏,因为每次我导航到图形视图时都会重新创建ViewModel,并且DispatcherTimer阻止了GC破坏我的ViewModel,因为Tick-Event拥有强大的引用。
我与包装解决了这个围绕它使用的DispatcherTimer FastSmartWeakEvent从CodeProject /丹尼尔·格伦沃尔德以避免强烈的参考VM和破坏自己一旦有没有更多的听众:
public class WeakDispatcherTimer
{
/// <summary>
/// the actual timer
/// </summary>
private DispatcherTimer _timer;
public WeakDispatcherTimer(TimeSpan interval, DispatcherPriority priority, EventHandler callback, Dispatcher dispatcher)
{
Tick += callback;
_timer = new DispatcherTimer(interval, priority, Timer_Elapsed, dispatcher);
}
public void Start()
{
_timer.Start();
}
private void Timer_Elapsed(object sender, EventArgs e)
{
_tickEvent.Raise(sender, e);
if (_tickEvent.EventListenerCount == 0) // all listeners have been garbage collected
{
// kill the timer once the last listener is gone
_timer.Stop(); …Run Code Online (Sandbox Code Playgroud)