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 4335666
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:42:04+00:00 2026-05-21T10:42:04+00:00

Hi I want to make bar chart as shown here I want to plot

  • 0

Hi I want to make bar chart as shown here

enter image description here

I want to plot graph using coreplot example : (coreplot gallery- Vertical Bar Chart)

Currently default code plots the graph as shown below

enter image description here

How can I achieve this?

I tried adding another graph but didn’t work out well.

Please Help and Suggest

Thanks

  • 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-21T10:42:05+00:00Added an answer on May 21, 2026 at 10:42 am

    Here is my solution:
    enter image description here

    In your code you need to add the following:

    -(NSNumber *)numberForPlot:(CPPlot *)plot
                     field:(NSUInteger)fieldEnum
               recordIndex:(NSUInteger)index
    {
        if (plot.identifier==@"locked") {
            switch ( fieldEnum ) {
                case CPBarPlotFieldBarLocation:
                    return (NSDecimalNumber *)[NSDecimalNumber numberWithUnsignedInteger:index];
                case CPBarPlotFieldBarLength:
                    return [self.lockedPercentage objectAtIndex:index];
                }
        }else if (plot.identifier==@"occupied") {
            switch ( fieldEnum ) {
                case CPBarPlotFieldBarLocation:
                    return (NSDecimalNumber *)[NSDecimalNumber numberWithUnsignedInteger:index];
                case CPBarPlotFieldBarLength:
                    return [self.occupiedPercentage objectAtIndex:index];
            }
        }else if (plot.identifier==@"empty") {
            switch ( fieldEnum ) {
                case CPBarPlotFieldBarLocation:
                    return (NSDecimalNumber *)[NSDecimalNumber numberWithUnsignedInteger:index];
                case CPBarPlotFieldBarLength:
                    return [self.emptyPercentage objectAtIndex:index];
            }
        }
        return nil;
    }
    

    The lines plot.identifier are here important, they check which data to take, here occupied empty or locked.

    Of course you need to set these identifiers, I do this in a -(void) loadgraph:

    //  Bar plot Locked
    CPBarPlot *barPlot = [CPBarPlot tubularBarPlotWithColor:[CPColor blueColor] horizontalBars:NO];
    barPlot.dataSource = self;
    barPlot.baseValue = CPDecimalFromString(@"0");
    barPlot.barOffset = 0.0f+viewOffset;
    barPlot.barWidth = 15.0f;
    barPlot.identifier = @"occupied";
    
    [graph addPlot:barPlot toPlotSpace:plotSpace];
    

    Here one of my identifier is set. To display values below the x-axe you need to change your range:

        plotSpace.yRange = [CPPlotRange plotRangeWithLocation:CPDecimalFromFloat(0.0f) length:CPDecimalFromFloat(100.0f)];
    

    Hope this helps.

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

Sidebar

Related Questions

I want to make bar chart using jfreechart such that the bars which belong
I am making a bar graph in visifire and I want to make a
I've implemented a notification bar using django.contrib.messages . Now, I want to make extended
I want to make a bar plot where one of the values is much
i had soulation .i want to make navigation bar with items i will select
I want make datetimepicker in my project. Using jquery how it is possible? I
I am traversing a HTML document using javascript DOM. I want make a list
I have link for example domain.com/de/controler/action?param=value and I want make actionlink to keep same
Possible Duplicate: Make Browser Window Blink in Task Bar Hello I want to notify
I want make some progress bar in my application with three20 library when sending

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.