Skip to content

Commit

Permalink
如果 是 在StackBar,设置了UIColor.clear 颜色。那将不可点击,不可高亮
Browse files Browse the repository at this point in the history
  • Loading branch information
FreddyZeng committed Nov 2, 2017
1 parent ca884f6 commit 1545155
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Source/Charts/Highlight/BarHighlighter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ open class BarHighlighter: ChartHighlighter
{
let stackIndex = getClosestStackIndex(ranges: ranges, value: yValue)

if set.colors[stackIndex] == UIColor.clear {
return nil;
}

let pixel = chart
.getTransformer(forAxis: set.axisDependency)
.pixelForValues(x: high.x, y: ranges[stackIndex].to)
Expand Down
7 changes: 6 additions & 1 deletion Source/Charts/Renderers/BarChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,11 @@ open class BarChartRenderer: BarLineScatterCandleBubbleRenderer
if !isSingleColor
{
// Set the color for the currently drawn value. If the index is out of bounds, reuse colors.
context.setFillColor(dataSet.color(atIndex: j).cgColor)
let color = dataSet.color(atIndex: j)
if color == UIColor.clear {
continue
}
context.setFillColor(color.cgColor)
}

if dataSet.barCornerType == .allCornet {
Expand Down Expand Up @@ -708,6 +712,7 @@ open class BarChartRenderer: BarLineScatterCandleBubbleRenderer
continue
}


let trans = dataProvider.getTransformer(forAxis: set.axisDependency)

context.setFillColor(set.highlightColor.cgColor)
Expand Down

0 comments on commit 1545155

Please sign in to comment.