SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

0
0

Hi,
i am trying to create multiple Y Axis in my chart
1. Left side is showing Price Value, i.e. 1200, 1201…
2. Right side is showing the % change relative to certain price, i.e. 1%, 2%…
3. Both side label should be aligned so that 1200 1%, 1201 2% ….

Questions:
1. How to align the value on both Y Axis?
2. I want to assign multiple color to Y Axis, for example, blue for -ve value, red for +ve value, how to do that?

Thank you!

Version
Trial
  • You must to post comments
1
0

Hi Tommy,

I’m not 100% sure that I understand your requirements but I’ll try to answer your questions.

  1. To align two axes you need to use same VisibleRange so when you scroll one axes other will be scrolled as well. You can find a information about how to do this in our documentation ( the only difference is that we synchronize ranges across xAxes across different charts). Then you can use LabelProvider API to change yAxis labels and output per cent values.

  2. To change colors of axis labels you need to create custom LabelProvider and return SpannableString with ForegroundColorSpan:

    @Override
    public CharSequence formatLabel(Comparable dataValue) {
        Spannable spannable = new SpannableString(super.formatLabel(dataValue));
    
        spannable.setSpan(new ForegroundColorSpan(Color.BLUE), 0, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    
        return spannable;
    }
    

Is this suitable for your needs?

Hope it will help you!

Best regards,
Yura

  • tommy ng
    Thanks! Your answer is perfect
  • tommy ng
    May i ask how could i do the same in iOS? I need to do the same with Objective C
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.