Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7630191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:02:23+00:00 2026-05-31T06:02:23+00:00

I have a graph that keeps getting dynamically changing data from our server based

  • 0

I have a graph that keeps getting dynamically changing data from our server based on player statistics. The problem that I am having is that I am having trouble figuring out how to center the graph based on the data received. I thought I had it configured properly, but upon further testing we found the graph be completely off center. Below is the snippet of code located in my reloadData.

- (void)reloadData
{
    CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)Chart.defaultPlotSpace;
    if (maxY < valueMaxY || minY > valueMinY)
    {
        // Reload the plot graph
        maxY = valueMaxY + (valueMaxY / 2);

        // Properly align the Y-Axis
        int tickCount = maxY / 5;

        if(tickCount <= 1)
        {
            tickCount = 1;
        }

        plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromInt(tickCount * -1) length:CPTDecimalFromInt(maxY - (tickCount * -1))];

        CPTXYAxisSet *axisSet = (CPTXYAxisSet *)Chart.axisSet;
        CPTXYAxis *y = axisSet.yAxis;
        y.majorIntervalLength = CPTDecimalFromInt(tickCount);
        y.minorTicksPerInterval = 1;
        NSArray *exclusionRanges = [NSArray arrayWithObjects:
                       [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(-2.0) length:CPTDecimalFromFloat(2.0)],
                       nil];
        y.labelExclusionRanges = exclusionRanges;
    }

    [Chart reloadData];
}

Brief description is that I would like the chart centered according to the view that sotres it. If possible I would like no more than 5 ticks visible on both the y and x axis. What I am trying to do, from the snippet above is just the y-axis, is to get the data from the server and check if value is greater and less than the previous value. Then I call reloadData and check if the values received are greater than either the min or the max values from the previous message. If either then I readjust the graph and the plots.

Any advice would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T06:02:24+00:00Added an answer on May 31, 2026 at 6:02 am

    I figured it out. I had to get the total distance from my min to my max values then find the center of that. Once I got that I set the y-axis orthogonal point to be the center added to my minimum value.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created an application that creates bar graph based on inputs read from
Here's my situation. I have a graph that has different sets of data being
I have a graph library that I use to plot some data. This data
I have the following graph that I generated using ggplot2 I had finalPlot as
I have a pretty sizeable object graph that I have serialized to a file
I have a d3 force-directed graph that contains a group of nodes: var node
The situation is this: You have a Hibernate context with an object graph that
I have an XML file that encodes a directed acyclic graph (DAG) that represents
I have an undirected graph on matris by vertex adjacency relations like that; /*
I have an app that uses the Graph API to post activity to a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.