How can add the Y-axis values and line graph Values in charts(animations-custom animation line chart)?

2 posts, 0 answers
  1. Nandu
    Nandu avatar
    11 posts
    Member since:
    Aug 2015

    Posted 02 Sep 2015 Link to this post


    Im using this sample, I'm  implementing line chart in animations. In sample you are implemented random numbers but in application i have 2 different values of y-axis and line graph. how to compare the y-axis values and line graph values.

    im storing the dates and graph values in 2 different arrays of dataArray and fillAmount array.

    how can i pass the values to y-axis and line graph?

    for (int i = 0; i<10; i++) {
            [points addObject:[[TKChartDataPoint alloc] initWithX:[dateArray objectAtIndex:i] Y:@(arc4random() % 100)]];

    i don't want to give the random values, how to match the x-axis values and y-axis values 

    Please help me

    Thanks in Advance.

  2. Sophi
    Sophi avatar
    97 posts

    Posted 03 Sep 2015 Link to this post

    Hello Nando,

    Thank you for contacting us. 

    If I understand correctly you have two arrays - one with dates(dateArray) and one with numeric values(fillAmount). They both should have equal number of elements so that each element from the dateArray have a corresponding one from the fillAmount array. On each iteration of your loop you should create a TKChartDataPoint with X-value from dateArray and Y-value from fillAmount array. If this is the case, you can consider the following code snippet:
    for (int i = 0; i<10; i++) {
            [points addObject:[[TKChartDataPoint alloc] initWithX:[dateArray objectAtIndex:i] Y:[fillAmount objectAtIndex:i]];

    I hope this helps. Do not hesitate to write back if you need further assistance, .

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
Back to Top