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

All Answers » Re: Day or month divide vertical lines » Comments for "Re: Day or month divide vertical lines"
  • Evgeny Khramov
    i was trying with setMajorDelta setMinorDelta and setAutoTicks in CategoryDateAxis Do you advise using annotations? If that then why I need using ahhotations if chart has majorGridLines and minorGridLines?
  • Yura Khariton
    Well you wrote about vertical lines so assumed that you use VerticalLineAnnotation. If major/minor grid lines works for you then you can use them.
  • Evgeny Khramov
    Can you help me? Which one is better for me? major/minor grid lines fits for me? I see some examples and try by myself but major/minor grid lines do not works foe me. How can I do that with major/minor grid lines?
  • Yura Khariton
    Well it depends on your needs. It’s still unclear for me how chart should look like with these vertical lines. Do you need to display axis tick labels only for these vertical lines and how chart should work when you zoom it? I’m asking because if you override grid lines drawing to draw them only at the end of day/month then when you zoom chart to display for example 1 hour then there will be no grid lines (major and minor ) and no axis tick labels(major). If this is not a problem for you then you can override grid lines drawing but because you’re using category axis I need to know about content of your data series. In case if first point in xValues contains beginning of day (e.g. if you pull and append data for entire day only ) and you know how many points are in one day then you can just set Major/MinorDelta to amount of points per day and major/minor grid lines will be drawn only at the beginning of each day ( gridlines for 0 points, then for 0 + MajorDelta point, then for 0 + 2MajorDelta and so on ). If your data series can start at any point of day then you’ll need to create custom TickProvider which will search the ends of the day/month within VisibleRange and will add them as major/minor ticks.
  • Evgeny Khramov
    In my case when I zoom chart I need labels for x axies Now I`m trying to display annotation and no luck Even if I try add “Watermark” annotation from AnnotationsAreEasyFragment example In my case I see no text If I add VerticalLineAnnotation I see no lines ( And thank you for advice about “in case of using CategoryDateAxis you’ll need to assign index of Date in data series instead of Date itself” Where can add annotations? Can I add them in onVisibleRangeChanged() method?
  • Yura Khariton
    Can you post your code here? Do you see any exceptions in logcat? And yes, you can add annotations in onVisibleRangeChanged() but because annotation is Android View you need to create and assign its properties on UI thread. You can use SciChart’s built-in helper class and call its Dispatcher.runOnUiThread() method or use built-in functionality provided by Android (e.g. Activity.runOnUiThread() method and other similar alternatives )
  • Evgeny Khramov
    I posted code below