Javal Nanda
Javal Nanda

Reputation: 1838

Help needed for s7graphview

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.

Upvotes: 2

Views: 575

Answers (1)

5hrp
5hrp

Reputation: 2230

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.

Upvotes: 0

Related Questions