Setting the range of the chart after reloading


#1

According to the functionality of my application, i have to relaod a chart after every few minutes. Now the issue is that suppose the user has zoomed in the chart and is viewing a particular range. When the chart reloads it should reload with the same zoom level and the same range should be visible. i have been able to set the zoom but having issues setting the range.

i can fetch the range using chart.xAxis.axisRange but how do i set the range because i do not have the min and the max value.

When i use chart.xAxis.axisRange.minimum i get -0.5 and when i use chart.xAxis.axisRange.minimum i get 0.5 always. it is a sChartDateTimeAxis

Is there any way i can extract the min and max value of the range for sChartDateTimeAxis

Please help


#2

Hi Aks,

Try setting the ‘autoCalculateAxisRanges’ property on your chart to NO. This should stop the axes resetting their ranges between reloads.

You could do it manually by getting and setting the range as you suggest. I think the problem you were having is that the axes don’t actually have their range calculated until the chart has rendered, thus you were just seeing their default value. Since the axes don’t have their ranges calculated until the chart has rendered, to do it manually you’d need to:

  • Save the ranges before you reload.
  • Reload your chart.
  • Catch the chart after it reloads in the sChartRenderFinished: method and:
    • Set the ranges of your chart to the ranges you saved.
    • Redraw your chart.

But that seems like hard work when you can just do:
myChart.autoCalculateAxisRanges = NO;

Jan  :laughing:


#3

Hi Jan,

Thanks for such a quick reply. i am working on ios and could not find the autoCalculateAxisRanges property.

i am fetching the ranges in sChartWillStartLoadingData and am able to fetch the range as well as min and max value for a number axis.

The problem is for a date time axis. i am able to fetch the range but not the min and max value as it comes to -.5 and .5 always.

i am new to shinobi charts so please excuse me if i am doind something wrong :laughing:


#4

i have a trial version of shinobi charts and going to buy one soon. Is being a trial version the reason i do not see that property?


#5

Can you NSLog out the NSString returned by calling [ShinobiChart getInfo] please? This will tell me what version of ShinobiCharts you are using. The autoCalculateAxisRanges property should be available on the trial too.

Jan


#6

i had version 2.2.1. I downloaded the latest version 2.5.2 but it does not have the resources folder the version 2.2.1 had. So, when i include the framework in the project i get errors.

one error is for label in the SChartCrossHairTooltip.h.  I had created a subclass of this class and was setting the value to the label in the superclass but in the new version it is not able to find the definition of the label.

When i comment the code for the label i get the following reference errors 

  “_CTFontManagerRegisterGraphicsFont”, referenced from:

  “std::__throw_bad_alloc()”, referenced from:

  “std::_Rb_tree_decrement(std::_Rb_tree_node_base*)”, referenced from:

  “std::_Rb_tree_increment(std::_Rb_tree_node_base const*)”, referenced from:

  “std::_Rb_tree_increment(std::_Rb_tree_node_base*)”, referenced from:

  “std::__throw_length_error(char const*)”, referenced from:

  “std::_Rb_tree_rebalance_for_erase(std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)”, referenced from:

  “std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)”, referenced from:

  “std::terminate()”, referenced from:

  “vtable for __cxxabiv1::__class_type_info”, referenced from:

  “vtable for __cxxabiv1::__si_class_type_info”, referenced from:

  “operator delete(void*)”, referenced from:

  “operator new(unsigned long)”, referenced from:

  “___cxa_begin_catch”, referenced from:

  “___cxa_end_catch”, referenced from:

  “___cxa_pure_virtual”, referenced from:

  “___cxa_rethrow”, referenced from:

  “___gxx_personality_v0”, referenced from:


#7

Hi Aks,

Can you please ensure that you are referencing the following frameworks:

  • libstdc++.6.0.9.dylib
  • CoreText.framework

Thanks,
Jan


#8

Thanks jan that was the issue. Now all the errors are gone


#9

No problem! Glad I could help.

Jan


#10

Hi Aks,

kann you give me a hint how you were able to set the zoomlevel as you mentioned above in the initial post?

Thanks alot!