Giter Club home page Giter Club logo

chart.js-objc-wrapper's People

Contributors

bryant1410 avatar gyetvan-andras avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chart.js-objc-wrapper's Issues

How to use options and add a legend?

Hi,

Love the library, just starting to use it and absolutely love it. I am struggling though with trying to figure out how to declare and pass options like a legend to my line graph. Can you give an example of how that can be done?

I should have posted this earlier but this is the code I have so far but its throwing a javascript exception error.

- (void)addLine {
    NSArray* labels = @[@"A",@"B",@"C",@"D"];
    NSMutableArray* datasets = [NSMutableArray array];
    for(NSInteger i = 1; i < 4; i++) {
        CWPointDataSet* ds = [[CWPointDataSet alloc] initWithData:@[@([self random:100]),@([self random:100]),@([self random:100]),@([self random:100])]];
        ds.label = [NSString stringWithFormat:@"Label %ld",i];
        CWColor* c1 = [[CWColors sharedColors] pickColor];
        CWColor* c2 = [c1 colorWithAlphaComponent:0.5f];
        ds.fillColor = c2;
        ds.strokeColor = c1;
        
        [datasets addObject:ds];
    }
    CWLineChartOptions* opt = [[CWLineChartOptions alloc] init];
    int varGrid = 1;
    opt.legendTemplate = @"<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].strokeColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>";
    opt.scaleGridLineWidth = [NSNumber numberWithInt:varGrid];
    
    CWLineChartData* lcd = [[CWLineChartData alloc] initWithLabels:labels andDataSet:datasets];
    self.lineChart = [[CWLineChart alloc] initWithWebView:self.webview name:@"LineChart1" width:300 height:200 data:lcd options:opt];
    
    [self.lineChart addChart];
}

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.