 struct ChartParams {
     let marginRatio: (CGFloat, CGFloat)
     let backgroundColor: NSColor
-    let titleFont: NSFont
-    let titleColor: NSColor
-    let borderColor: NSColor
-    let borderWidth: CGFloat
-    let highlightedBorderWidth: CGFloat
-    let majorGridlineColor: NSColor
-    let majorGridlineParams: LineParams
-    let minorGridlineColor: NSColor
-    let minorGridlineParams: LineParams
-    let axisLabelFont: NSFont
-    let legendFont: NSFont
-    let legendColor: NSColor
+    let title: TextParams
+    let border: LineParams
+    let highlightedBorder: LineParams
+    let majorGridline: LineParams
+    let minorGridline: LineParams
+    let axisLabel: TextParams
+    let legend: TextParams
     let legendPadding: CGFloat
-    let lineParams: LineParams
-    let shadowRadius: CGFloat
-    let hairline: Bool
+    let legendSampleLine: Bool
+    let lineParams: (Int, Int) -> [LineParams]
     let xPadding: CGFloat
 
-
-    func lineParams(for kind: Gridline.Kind) -> (color: NSColor, params: LineParams) {
+    func lineParams(for kind: Gridline.Kind) -> LineParams {
         switch kind {
-        case .major:
-            return (majorGridlineColor, majorGridlineParams)
-        case .minor:
-            return (minorGridlineColor, minorGridlineParams)
-        }
-    }
-
-    func axisLabelAttributes() -> [String: Any] {
-        return [
-            NSFontAttributeName: axisLabelFont,
-            NSForegroundColorAttributeName: titleColor
-        ]
+        case .major: return majorGridline
+        case .minor: return minorGridline
+        }
     }
 }
 

            (label as NSString).draw(at: rightPos, withAttributes: attributes)
            previousFrame = frame
        }
    }

    func drawXAxis() {
        let gridlines = chart.sizeScale.gridlines
        let attributes = params.axisLabelAttributes()

        // Calculate frames for labels on the size axis
        typealias LabelGeometry = (gridline: Gridline, position: CGPoint, frame: CGRect)

            path.move(to: CGPoint(x: 0, y: gridline.position))
            path.line(to: CGPoint(x: 1, y: gridline.position))
            path.transform(using: chartTransform)
            path.stroke(with: params.lineParams(for: gridline.kind))
        }
        NSGraphicsContext.restoreGraphicsState()

        // Draw labels
        NSGraphicsContext.saveGraphicsState()
        var previousFrame = CGRect.null
        let attributes = params.axisLabel.attributes
        for gridline in gridlines where gridline.kind == .major {
            guard let label = gridline.label else { continue }
            let yMid = chartRect.minY + gridline.position * chartRect.height + params.axisLabel.font.pointSize / 4

            let bounds = (label as NSString).boundingRect(with: CGSize(width: 1000, height: 1000),
                                                          options: [], attributes: attributes)
