This is a migrated thread and some comments may be shown as answers.

TKChartDelegate - paletteItemForPoint

2 Answers 21 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Matt
Top achievements
Rank 1
Matt asked on 14 Sep 2015, 03:20 PM

I'm trying to create a spark line chart, and for the chart, I want only the last data point to be a red circle.  To do this, I need to use the paletteItemForPoint delegate method.  I am able to get the chart drawn with the correct range background, however, the paletteItemForPoint is not called, but paletteItemForSeries is called.  Is there a reason why paletteItemForPoint would not be called.

 

- (id)initWithFrame:(CGRect) frame
{
    self = [super initWithFrame:frame];
    
    if(self) {
        self.sparkLineChart = [[TKChart alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)];
        [self.sparkLineChart setBackgroundColor:[UIColor clearColor]];
        [self.sparkLineChart setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
        
        self.sparkLineChart.legend.hidden = YES;
        self.sparkLineChart.delegate = self;
        self.sparkLineChart.dataSource = self;
        self.sparkLineChart.title.hidden = YES;
        self.sparkLineChart.backgroundColor = [UIColor clearColor];
        self.sparkLineChart.plotViewInsets = UIEdgeInsetsMake(0, 0, 0, 0);
        self.sparkLineChart.insets = UIEdgeInsetsMake(0, 0, 0, 0);
        self.sparkLineChart.gridStyle.horizontalLinesHidden = YES;
        self.sparkLineChart.gridStyle.horizontalAlternateFill = nil;
        self.sparkLineChart.gridStyle.horizontalFill = nil;
        self.sparkLineChart.gridStyle.verticalLinesHidden = YES;
        self.sparkLineChart.gridStyle.verticalAlternateFill = nil;
        self.sparkLineChart.gridStyle.verticalFill = nil;
        [self addSubview:self.sparkLineChart];
    }
    
    return self;
}​

2 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 15 Sep 2015, 11:43 AM
Hi Matt,

Thank you for contacting us.

You should first set the pointShape in order to use the chart:paletteItemForPoint:inSeries: method. Consider the sample below:
- (TKChartSeries *)seriesForChart:(TKChart *)chart atIndex:(NSUInteger)index
{
    TKChartLineSeries *series = [TKChartLineSeries new];
    series.style.pointShape = [TKPredefinedShape shapeWithType:TKShapeTypeCircle andSize:CGSizeMake(10, 10)];
    return series;
}

I hope this helps.

Regards,
Jack
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Matt
Top achievements
Rank 1
answered on 15 Sep 2015, 03:06 PM
That was the step I was missing, Thanks!
Tags
Chart
Asked by
Matt
Top achievements
Rank 1
Answers by
Jack
Telerik team
Matt
Top achievements
Rank 1
Share this question
or