This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Charts | |
import CoreGraphics | |
import Foundation | |
import UIKit | |
/// 棒グラフで角丸を再現するために https://gist.github.com/ShadeApps/9285904fc716dbe6c13c6fbff23ab27e を参考に作成 | |
class BarChartRenderer: BarLineScatterCandleBubbleRenderer { | |
/// A nested array of elements ordered logically (i.e not in visual/drawing order) for use with VoiceOver | |
/// | |
/// Its use is apparent when there are multiple data sets, since we want to read bars in left to right order, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// CombinedChartRendererが公開しているsubRenderersだとdataを設定した際に初期化されてしまうので_renderersを利用しているところを外から設定できるようにした | |
final class CustomCombinedChartRenderer: CombinedChartRenderer { | |
var customRenderers: [DataRenderer] = [] | |
override func initBuffers() { | |
customRenderers.forEach { $0.initBuffers() } | |
} | |
override func drawData(context: CGContext) { | |
// If we redraw the data, remove and repopulate accessible elements to update label values and frames | |
accessibleChartElements.removeAll() |
OlderNewer