Pre loader

Tag: OHLC Group Chart

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0 votes
3k views

Hi,

is it possible to have same colors on my volume chart based on OHLC chart (red Green)? One option I see is to create a dependency property, and bind to OHLC Series data source to my VolumePalletteProvider? Is there any pre-existing way, without requiring me to bind to OHLC Series source?

public class VolumePallettProvider : IStrokePaletteProvider, IFillPaletteProvider
{
    Color _sbC = Colors.LightPink;
    SolidColorBrush _sb = Brushes.Transparent;

    public void OnBeginSeriesDraw(IRenderableSeries series)
    {
        _sbC = (Color)ColorConverter.ConvertFromString("#FF713232");
        _sb = (SolidColorBrush)new BrushConverter().ConvertFromString("#FFB75252");
    }

    public Brush OverrideFillBrush(IRenderableSeries rSeries, int index, IPointMetadata metadata)
    {
        var series = rSeries.DataSeries as XyDataSeries<DateTime, double>;
        var value = null != series ? series.YValues[index] : 0;
        value = !Double.IsNaN(value) ? value : 0;
        if (value < 0)
            return _sb;
        return null;
    }

    public Color? OverrideStrokeColor(IRenderableSeries rSeries, int index, IPointMetadata metadata)
    {
        var series = rSeries.DataSeries as XyDataSeries<DateTime, double>;
        var value = null != series ? series.YValues[index] : 0;
        value = !Double.IsNaN(value) ? value : 0;
        if (value < 0)
            return _sbC;
        return null;
    }
}
Showing 1 result

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies