お世話になります。
ios-chartsを使用して、チャートを描画しているのですが、
デリゲートメソッドの**__ chartValueSelected__**で選択された箇所のcircleColorを変更しています。
同時に、選択された箇所のcircleRadiusの値も変更したいのですが、方法がわかりません。
circleColorsは配列で設定できるため、インデックスで該当の箇所のみ色を変更ができています。
circleRadiusについては、個別の値が設定できるのでしょうか?
また、無理な場合、他の手段はありますでしょうか?
ご教示頂けますと幸いです。
デリゲートメソッドのソースを下記に記載致します。
func chartValueSelected(_ chartView: ChartViewBase, entry: ChartDataEntry, highlight: Highlight) { print("chartValueSelected : x = (highlight.x) y = (highlight.y)") var set1 = LineChartDataSet() set1 = (chartView.data?.dataSets[0] as? LineChartDataSet)! let index = set1.entryIndex(entry: entry) set1.circleColors = self.circleColors set1.circleColors[index] = UIColor.red chartView.data?.notifyDataChanged() chartView.notifyDataSetChanged() } public func chartValueNothingSelected(_ chartView: ChartViewBase) { print("chartValueNothingSelected") var set1 = LineChartDataSet() set1 = (chartView.data?.dataSets[0] as? LineChartDataSet)! set1.circleColors = self.circleColors chartView.data?.notifyDataChanged() chartView.notifyDataSetChanged() } }
あなたの回答
tips
プレビュー