visualdatatools.com Forum Index visualdatatools.com
Discussion for DataTank and DataGraph
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

setColor:forEntry: "Fill Method"Needs to be a colo

 
Post new topic   Reply to topic    visualdatatools.com Forum Index -> DataGraph Framework
View previous topic :: View next topic  
Author Message
GWilliam



Joined: 18 Nov 2009
Posts: 73

PostPosted: Mon Nov 18, 2013 5:39 pm    Post subject: setColor:forEntry: "Fill Method"Needs to be a colo Reply with quote

Dear,

I am trying to plot filled Plots Command with a Solid color, to make contour plot as http://www.idlcoyote.com/gallery/filled_contour_plot_1.png.
My code bellow :

Code:

for(int iC = 0; iC < nContourLevel; iC+=2 )
{
[dgraph addDataColumnWithName:[NSString stringWithFormat:@"xCONT_%i",iC+1] type:@"Ascii"];
      [dgraph addDataColumnWithName:[NSString stringWithFormat:@"yCONT_%i",iC+1] type:@"Ascii"];
      [[dgraph dataColumnAtIndex:iC+1] setDataFromArray:[_data valueForKey:[NSString stringWithFormat:@"xCONT_%i",iC+1]]];
      [[dgraph dataColumnAtIndex:iC+2] setDataFromArray:[_data valueForKey:[NSString stringWithFormat:@"yCONT_%i",iC+1]]];

DGCommand *cmd = [dgraph addDrawingCommandWithType:@"Plot”];

NSColor *lineColor = [NSColor colorWithHue:(1-((CGFloat) iC)/((CGFloat) nContourLevel-1))*0.75
                                 saturation:1 brightness:1 alpha:1];
         [cmd setColor:lineColor forEntry:@"Line Style"];
         if(! [[[_graphStyle cell] title] compare:@"Cont 3"])
         {
            [cmd setColor:lineColor forEntry:@"Fill Method"];
            [(DGPlotCommand*) cmd setFillStyle:DGPlotCommandFillY];
         }
}


But I received the errors :
Code:
setColor:forEntry: "Fill Method"Needs to be a color or a line style selector


I do not understand why I received this error because I gave an NSColor object as input for the Fill Method.
Back to top
View user's profile Send private message
klaxamazoo



Joined: 17 Jul 2009
Posts: 47
Location: Artic

PostPosted: Mon Nov 18, 2013 9:40 pm    Post subject: Reply with quote

I don't think Fill settings are available in the current Framework, but I'm not sure.

Under:
Code:
// ///////////////////////////////////////////////////////////////////
// Low level getters and setters.
// Every property has a key name, and you can set and get them
// using that key.  The recommended method is to use the methods
// in the derived class instead
// ///////////////////////////////////////////////////////////////////


For Fill Style it says:
Code:
// Fill style - upon request



It looks like there is a DGFillSettings.h:
Code:
#import <Cocoa/Cocoa.h>
#import "DGCommandConstants.h"

@class DGCommand;
@class DPFillStyleInputController;

@interface DGFillSettings : NSObject
{
    DGCommand *command;
    DPFillStyleInputController *fill;
}

// Set the color settings
- (void)setSolidColor:(NSColor *)col; // Color is specified
- (void)setSolidColorType:(DGColorNumber)num; // One of the style colors

- (void)setPatternBackground:(NSColor *)bcol lineColor:(NSColor *)lcol lineWidth:(double)lw patternType:(DGPatternType)type;

- (void)setGradientFirstColor:(NSColor *)fcol secondColor:(NSColor *)scol;
- (void)setGradientFirstColor:(NSColor *)fcol secondColor:(NSColor *)scol colorPosition:(double)f thirdColor:(NSColor *)tcol;

- (void)setTextureBackground:(NSColor *)bcol foreground:(NSColor *)fcol weight:(double)w grain:(double)g;

@end


But I don't see a method for turning fills on and off.
Back to top
View user's profile Send private message
GWilliam



Joined: 18 Nov 2009
Posts: 73

PostPosted: Tue Nov 19, 2013 10:08 am    Post subject: Reply with quote

klaxamazoo wrote:
I don't think Fill settings are available in the current Framework, but I'm not sure.

[…]
For Fill Style it says:
Code:
// Fill style - upon request




Thanks for the precision, I havn’t noticed this little detail, and I almost spend all last eening trying to make it work Confused
Back to top
View user's profile Send private message
klaxamazoo



Joined: 17 Jul 2009
Posts: 47
Location: Artic

PostPosted: Wed Nov 20, 2013 12:38 am    Post subject: Reply with quote

I think it is still worth trying. It looks like the methods you were using are close and suggest that the Framework has the capability to change fill settings.

I looked at the "Fill Method" entry, and I don't think it is a color, but is a Tag. I tried setting the Tag to different values; however, it doesn't turn on the fill.

It looks like turning on the Fill is in "Fill" dictionary under "Type". I suggest playing around with DGFillSettings class.




Code:
#import <Cocoa/Cocoa.h>
#import "DGCommandConstants.h"

@class DGCommand;
@class DPFillStyleInputController;

@interface DGFillSettings : NSObject
{
    DGCommand *command;
    DPFillStyleInputController *fill;
}

// Set the color settings
- (void)setSolidColor:(NSColor *)col; // Color is specified
- (void)setSolidColorType:(DGColorNumber)num; // One of the style colors

- (void)setPatternBackground:(NSColor *)bcol lineColor:(NSColor *)lcol lineWidth:(double)lw patternType:(DGPatternType)type;

- (void)setGradientFirstColor:(NSColor *)fcol secondColor:(NSColor *)scol;
- (void)setGradientFirstColor:(NSColor *)fcol secondColor:(NSColor *)scol colorPosition:(double)f thirdColor:(NSColor *)tcol;

- (void)setTextureBackground:(NSColor *)bcol foreground:(NSColor *)fcol weight:(double)w grain:(double)g;

@end


Also, here is a quick method to check which selector to use when accessing an entryName:

Code:
-(void) logEntryAccessTypeForEntry: (NSString *)entryName forCommand:(DGCommand *)command {
    NSLog(@"Checking entry access for ENTRY: %@ in COMMAND: %@", entryName, [command type]);
    id entryQueryResult = nil;      // use entryQueryResult as an intermediate so that only one DCallBackError is made per entryName
   
   
    // COLOR
    entryQueryResult = [command getColorForEntry: entryName];
    if (entryQueryResult) {
        NSLog(@"COLOR  :  %@ = %@", entryName, entryQueryResult);
    }
   
    // NUMBER
    entryQueryResult = [command getNumberForEntry: entryName];
    if (entryQueryResult) {
        NSLog(@"NUMBER:   %@ = %@", entryName, entryQueryResult);
    }
   
    // STRING
    entryQueryResult = [command getStringForEntry: entryName];
    if (entryQueryResult) {
        NSLog(@"STRING:   %@ = %@", entryName, entryQueryResult);
    }
   
    // TOKEN
    entryQueryResult = [command getTokensForEntry: entryName];
    if (entryQueryResult) {
        NSLog(@"TOLKINS:  %@ = %@", entryName, entryQueryResult);
    }
   
   
    // TAG
    int integerEntryQueryResult = [command selectedTagForEntry: entryName];
    if (integerEntryQueryResult) {
        NSLog(@"TAG:      %@ = %i", entryName, integerEntryQueryResult);
    }
   
   
    NSLog(@"\n\n\n\n");
}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    visualdatatools.com Forum Index -> DataGraph Framework All times are GMT - 3 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group