2

If anyone have used s7graphview for plotting the graph then I want to know where to do changes in the code for maintaining the incremental value of the values that is been plot on the x-axis. Currently it maintains according to the count of array being return to it. I want to maintain incremental gap of 5 units.

Kshitiz Ghimire
  • 1,716
  • 3
  • 18
  • 37
Javal Nanda
  • 1,828
  • 3
  • 14
  • 26

1 Answers1

0

I replace in drawRect: of S7GraphView class next lines (~220 line in S7GraphView.m):

if (xValuesCount > 5)
{       
    NSUInteger stepCount = 5;
    NSUInteger count = xValuesCount - 1;

    for (NSUInteger i = 4; i < 8; i++) {
        if (count % i == 0) {
            stepCount = i;
        }
    }

    step = xValuesCount / stepCount;
    maxStep = stepCount + 1;
}
else
{       
    step = 1;
    maxStep = xValuesCount;
}

with this code:

if (xValuesCount > 5)
{       
    NSUInteger stepCount = 5 - 1;

    step = xValuesCount / stepCount;
    maxStep = stepCount + 1;
}
else
{       
    step = 1;
    maxStep = xValuesCount;
}

On DemoS7GraphView project from s7graph google code page it gives me next result: result from code changing

Hope it helps.

5hrp
  • 2,230
  • 1
  • 18
  • 18