Giter VIP home page Giter VIP logo

Comments (3)

will-tm avatar will-tm commented on July 22, 2024

Hi Georges,
This is weird, I will take a look a it as soon as possible!

from wmgaugeview.

will-tm avatar will-tm commented on July 22, 2024

Hi George,
Does this commit fixes your issue? I have not been able to reproduce your issue.
Please provide more informations.

from wmgaugeview.

geogerar avatar geogerar commented on July 22, 2024

Hello again!
Problem HAS NOT BEEN SOLVED! .... Needle keeps going around all the time and suddenly after some seconds (15-30) one or two needle from three stops. The other keep moving round......

I attach my code......to take a look

// Percentage_ViewController.h
//
// Created by GEORGE GERARDIS on 26/12/13.
// Copyright (c) 2013 GEORGE GERARDIS. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "WMGaugeView.h"

@interface Percentage_ViewController : UIViewController

@Property (strong, nonatomic) IBOutlet UILabel *percentage_label;
@Property (strong, nonatomic) IBOutlet WMGaugeView *percentage_chart1;
@Property (strong, nonatomic) IBOutlet WMGaugeView *percentage_chart2;
@Property (strong, nonatomic) IBOutlet WMGaugeView *percentage_chart3;
@Property (strong, nonatomic) IBOutlet UIView *full_view;
@Property (strong, nonatomic) NSArray *modeldata_percentage;

@EnD

// Percentage_ViewController.m
//
// Created by GEORGE GERARDIS on 26/12/13.
// Copyright (c) 2013 GEORGE GERARDIS. All rights reserved.
//
#import "Percentage_ViewController.h"
#import "TSLanguageManager.h"

#define RGB(r,g,b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1.0]
@interface Percentage_ViewController ()
@EnD

@implementation Percentage_ViewController

@synthesize percentage_label;
@synthesize percentage_chart1;
@synthesize percentage_chart2;
@synthesize percentage_chart3;
@synthesize full_view;
@synthesize modeldata_percentage;

  • (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
    {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
    // Custom initialization
    }
    return self;
    }

  • (void)viewDidLoad
    {
    [super viewDidLoad];
    // Do any additional setup after loading the view.

    self.tabBarController.navigationItem.title = [TSLanguageManager localizedString:@"Γραφήματα"];

    UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:[TSLanguageManager localizedString:@"ΠΙΣΩ"] style:UIBarButtonItemStylePlain target:nil action:nil];
    self.navigationItem.backBarButtonItem = backButton;

    //Get the tabBarItem
    UITabBarController *tb = [self tabBarController];
    //Give it a label
    [[tb.tabBar.items objectAtIndex:0] setTitle:[TSLanguageManager localizedString:@"Γράφημα Ράβδου"]];
    [[tb.tabBar.items objectAtIndex:1] setTitle:[TSLanguageManager localizedString:@"Γράφημα Πίττας"]];
    [[tb.tabBar.items objectAtIndex:2] setTitle:[TSLanguageManager localizedString:@"Πονταρίσματα"]];
    [[tb.tabBar.items objectAtIndex:3] setTitle:[TSLanguageManager localizedString:@"Καθαρά Ποσά"]];
    [[tb.tabBar.items objectAtIndex:4] setTitle:[TSLanguageManager localizedString:@"%"]];

    percentage_label.text = [modeldata_percentage objectAtIndex:9];

    float a = [[modeldata_percentage objectAtIndex:5] intValue];
    float b = [[modeldata_percentage objectAtIndex:6] intValue];
    float c = [[modeldata_percentage objectAtIndex:7] intValue];
    float d = [[modeldata_percentage objectAtIndex:8] intValue];
    float a_b = ( a + b );
    float c_d = ( c + d );

    if (d < 0) d = d * (-1);

    CGFloat pos_epi = 0;
    CGFloat pos_apo = 0;
    CGFloat roi = 0;
    ///
    roi = c_d;
    ///
    roi = [[modeldata_percentage objectAtIndex:11] floatValue];
    pos_epi = 100 * ( a / a_b );
    pos_apo = 100 * ( b / a_b );

///////////////////////////////////////////////////////////////////////////////////////////

//Add Percentage Chart 1
self.percentage_chart1.minValue = 0.0;
self.percentage_chart1.maxValue = 100.0;

self.percentage_chart1.scaleStartAngle = 45;
self.percentage_chart1.scaleEndAngle = 315;

self.percentage_chart1.unitOfMeasurementFont = [UIFont fontWithName:@"Verdana-Bold" size:0.045];
self.percentage_chart1.unitOfMeasurementVerticalOffset = 0.85;
self.percentage_chart1.unitOfMeasurement = [NSString stringWithFormat:@"%@ : %.02f%%",[TSLanguageManager localizedString:@"Επιτυχίες"], pos_epi];
self.percentage_chart1.showUnitOfMeasurement = YES;

self.percentage_chart1.rangeValues = @[ @100 ];
self.percentage_chart1.rangeColors = @[ RGB(50, 205, 50) ];

self.percentage_chart1.showRangeLabels = YES;
self.percentage_chart1.rangeLabels = @[ [TSLanguageManager localizedString:@"ΕΠΙΤΥΧΙΕΣ"] ];
self.percentage_chart1.rangeLabelsFont = [UIFont fontWithName:@"Verdana-Bold" size:0.05];
self.percentage_chart1.rangeLabelsFontKerning = 2.0;
self.percentage_chart1.rangeLabelsWidth = 0.06;

self.percentage_chart1.scaleDivisions = 10;
self.percentage_chart1.scaleDivisionsWidth = 0.005;
self.percentage_chart1.scaleDivisionsLength = 0.05;

self.percentage_chart1.scaleSubdivisions = 10;
self.percentage_chart1.scalesubdivisionsaligment = WMGaugeViewSubdivisionsAlignmentTop;
self.percentage_chart1.scaleSubdivisionsWidth = 0.002;
self.percentage_chart1.scaleSubdivisionsLength = 0.02;

self.percentage_chart1.innerRimBorderWidth = 1;
self.percentage_chart1.innerRimWidth = 1;

self.percentage_chart1.showScaleShadow = YES;
self.percentage_chart1.innerBackgroundStyle = WMGaugeViewInnerBackgroundStyleGradient;
self.percentage_chart1.scaleFont = [UIFont boldSystemFontOfSize:0.05];

self.percentage_chart1.needleStyle = WMGaugeViewNeedleStyle3D;
self.percentage_chart1.needleWidth = 0.025;
self.percentage_chart1.needleHeight = 0.4;
self.percentage_chart1.needleScrewStyle = WMGaugeViewNeedleScrewStyleGradient;
self.percentage_chart1.needleScrewRadius = 0.05;

self.percentage_chart1.value = pos_epi;

//Add Percentage Chart 2
self.percentage_chart2.minValue = 0.0;
self.percentage_chart2.maxValue = 100.0;

self.percentage_chart2.scaleStartAngle = 45;
self.percentage_chart2.scaleEndAngle = 315;

self.percentage_chart2.unitOfMeasurementFont = [UIFont fontWithName:@"Verdana-Bold" size:0.045];
self.percentage_chart2.unitOfMeasurementVerticalOffset = 0.85;
self.percentage_chart2.unitOfMeasurement = [NSString stringWithFormat:@"%@ : %.02f%%",[TSLanguageManager localizedString:@"Αποτυχίες"], pos_apo];
self.percentage_chart2.showUnitOfMeasurement = YES;

self.percentage_chart2.rangeValues = @[ @100 ];
self.percentage_chart2.rangeColors = @[ RGB(255, 0, 0) ];

self.percentage_chart2.showRangeLabels = YES;
self.percentage_chart2.rangeLabels = @[ [TSLanguageManager localizedString:@"ΑΠΟΤΥΧΙΕΣ"] ];
self.percentage_chart2.rangeLabelsFont = [UIFont fontWithName:@"Verdana-Bold" size:0.05];
self.percentage_chart2.rangeLabelsFontKerning = 2.0;
self.percentage_chart2.rangeLabelsWidth = 0.06;

self.percentage_chart2.scaleDivisions = 10;
self.percentage_chart2.scaleDivisionsWidth = 0.005;
self.percentage_chart2.scaleDivisionsLength = 0.05;

self.percentage_chart2.scaleSubdivisions = 10;
self.percentage_chart2.scalesubdivisionsaligment = WMGaugeViewSubdivisionsAlignmentTop;
self.percentage_chart2.scaleSubdivisionsWidth = 0.002;
self.percentage_chart2.scaleSubdivisionsLength = 0.02;

self.percentage_chart2.innerRimBorderWidth = 1;
self.percentage_chart2.innerRimWidth = 1;

self.percentage_chart2.showScaleShadow = YES;
self.percentage_chart2.innerBackgroundStyle = WMGaugeViewInnerBackgroundStyleGradient;
self.percentage_chart2.scaleFont = [UIFont boldSystemFontOfSize:0.05];

self.percentage_chart2.needleStyle = WMGaugeViewNeedleStyle3D;
self.percentage_chart2.needleWidth = 0.025;
self.percentage_chart2.needleHeight = 0.4;
self.percentage_chart2.needleScrewStyle = WMGaugeViewNeedleScrewStyleGradient;
self.percentage_chart2.needleScrewRadius = 0.05;

self.percentage_chart2.value = pos_apo;

//Add Percentage Chart 3
self.percentage_chart3.minValue = -100.0;
self.percentage_chart3.maxValue = 100.0;

self.percentage_chart3.scaleStartAngle = 90;
self.percentage_chart3.scaleEndAngle = 270;

self.percentage_chart3.unitOfMeasurementFont = [UIFont fontWithName:@"Verdana-Bold" size:0.045];
self.percentage_chart3.unitOfMeasurementVerticalOffset = 0.57;
self.percentage_chart3.unitOfMeasurement = [NSString stringWithFormat:@"Yield : %.02f%%", roi];
self.percentage_chart3.showUnitOfMeasurement = YES;

self.percentage_chart3.rangeValues = @[ @0,                  @100 ];
self.percentage_chart3.rangeColors = @[ RGB(255, 0, 0),      RGB(50, 205, 50) ];

self.percentage_chart3.showRangeLabels = YES;
self.percentage_chart3.rangeLabels = @[ @"ΑΡΝΗΤΙΚΟ  YIELD",          @"ΘΕΤΙΚΟ  YIELD" ];
self.percentage_chart3.rangeLabelsFont = [UIFont fontWithName:@"Verdana-Bold" size:0.05];
self.percentage_chart3.rangeLabelsFontKerning = 1.0;
self.percentage_chart3.rangeLabelsWidth = 0.06;

self.percentage_chart3.scaleDivisions = 10;
self.percentage_chart3.scaleDivisionsWidth = 0.005;
self.percentage_chart3.scaleDivisionsLength = 0.05;

self.percentage_chart3.scaleSubdivisions = 10;
self.percentage_chart3.scalesubdivisionsaligment = WMGaugeViewSubdivisionsAlignmentTop;
self.percentage_chart3.scaleSubdivisionsWidth = 0.002;
self.percentage_chart3.scaleSubdivisionsLength = 0.02;

self.percentage_chart3.innerRimBorderWidth = 1;
self.percentage_chart3.innerRimWidth = 1;

self.percentage_chart3.showScaleShadow = YES;
self.percentage_chart3.innerBackgroundStyle = WMGaugeViewInnerBackgroundStyleGradient;
self.percentage_chart3.scaleFont = [UIFont boldSystemFontOfSize:0.05];

self.percentage_chart3.needleStyle = WMGaugeViewNeedleStyle3D;
self.percentage_chart3.needleWidth = 0.025;
self.percentage_chart3.needleHeight = 0.4;
self.percentage_chart3.needleScrewStyle = WMGaugeViewNeedleScrewStyleGradient;
self.percentage_chart3.needleScrewRadius = 0.05;

self.percentage_chart3.value = roi;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////// save view in image /////////////////////////////

UIGraphicsBeginImageContext(full_view.bounds.size);
[full_view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image_view = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSData *imageData = UIImagePNGRepresentation(image_view);       //convert image into .png format.
NSString *tmpDirectory = NSTemporaryDirectory();
NSString *fullPath3 = [tmpDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@_C5.png", [modeldata_percentage objectAtIndex:10]]];
[[NSFileManager defaultManager] removeItemAtPath:fullPath3 error:nil];
[[NSFileManager defaultManager] createFileAtPath:fullPath3 contents:imageData attributes:nil];

////////////////////////////////////////////////////////////////////////////////
}

  • (void)didReceiveMemoryWarning
    {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
    }

@EnD

from wmgaugeview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.