KChartWidget constructor

KChartWidget(
  1. List<KLineEntity>? datas, {
  2. ChartStyle? chartStyle,
  3. ChartColors? chartColors,
  4. bool enableTheme = true,
  5. required bool isTrendLine,
  6. double xFrontPadding = 100,
  7. MainState mainState = MainState.MA,
  8. SecondaryState secondaryState = SecondaryState.MACD,
  9. dynamic onSecondaryTap()?,
  10. bool volHidden = false,
  11. bool isLine = false,
  12. bool isTapShowInfoDialog = false,
  13. bool hideGrid = false,
  14. bool isChinese = false,
  15. bool showNowPrice = true,
  16. bool showInfoDialog = true,
  17. bool materialInfoDialog = true,
  18. Map<String, ChartTranslations> translations = kChartTranslations,
  19. List<String> timeFormat = TimeFormat.YEAR_MONTH_DAY,
  20. dynamic onLoadMore(
    1. bool
    )?,
  21. int fixedLength = 2,
  22. List<int> maDayList = const [5, 10, 20],
  23. int flingTime = 350,
  24. double flingRatio = 0.9,
  25. Curve flingCurve = Curves.easeOutCubic,
  26. dynamic isOnDrag(
    1. bool
    )?,
  27. VerticalTextAlignment verticalTextAlignment = VerticalTextAlignment.left,
  28. bool enableDrawingTools = false,
  29. DrawingToolManager? drawingToolManager,
  30. double minScale = 0.1,
  31. double maxScale = 5.0,
  32. double scaleAnimationDuration = 300.0,
  33. Curve scaleAnimationCurve = Curves.easeOutCubic,
  34. bool enableScaleAnimation = true,
  35. dynamic onScaleChanged(
    1. double
    )?,
  36. bool enableBoundaryFeedback = true,
  37. double scaleSensitivity = 2.5,
  38. bool enableScaleCenterPoint = true,
  39. KChartController? controller,
  40. bool enablePerformanceMode = false,
  41. bool enablePinchZoom = true,
  42. bool enableScrollZoom = true,
  43. double scrollZoomFactor = 1.1,
  44. bool enableScaleHapticFeedback = true,
  45. dynamic onCrossLineTap(
    1. double price
    )?,
  46. bool enableHapticFeedback = true,
  47. bool longPressHaptic = true,
  48. bool crossLineTapHaptic = true,
  49. bool scaleHaptic = false,
  50. bool boundaryHaptic = true,
})

Implementation

KChartWidget(
  this.datas, {
  this.chartStyle,
  this.chartColors,
  this.enableTheme = true, // 默认启用主题系统
  required this.isTrendLine,
  this.xFrontPadding = 100,
  this.mainState = MainState.MA,
  this.secondaryState = SecondaryState.MACD,
  this.onSecondaryTap,
  this.volHidden = false,
  this.isLine = false,
  this.isTapShowInfoDialog = false,
  this.hideGrid = false,
  this.isChinese = false,
  this.showNowPrice = true,
  this.showInfoDialog = true,
  this.materialInfoDialog = true,
  this.translations = kChartTranslations,
  this.timeFormat = TimeFormat.YEAR_MONTH_DAY,
  this.onLoadMore,
  this.fixedLength = 2,
  this.maDayList = const [5, 10, 20],
  this.flingTime = 350, // 更短惯性动画
  this.flingRatio = 0.9, // 更自然的惯性距离
  this.flingCurve = Curves.easeOutCubic, // 丝滑曲线
  this.isOnDrag,
  this.verticalTextAlignment = VerticalTextAlignment.left,
  // 绘图工具配置
  this.enableDrawingTools = false, // 默认关闭绘图工具
  this.drawingToolManager,
  // 缩放配置参数
  this.minScale = 0.1,
  this.maxScale = 5.0,
  this.scaleAnimationDuration = 300.0,
  this.scaleAnimationCurve = Curves.easeOutCubic,
  this.enableScaleAnimation = true,
  this.onScaleChanged,
  this.enableBoundaryFeedback = true,
  this.scaleSensitivity = 2.5, // 默认提升灵敏度
  this.enableScaleCenterPoint = true,
  this.controller,
  this.enablePerformanceMode = false, // 默认关闭性能模式
  // 双指缩放和滚轮缩放配置
  this.enablePinchZoom = true, // 默认启用双指缩放
  this.enableScrollZoom = true, // 默认启用滚轮缩放
  this.scrollZoomFactor = 1.1, // 滚轮缩放倍数
  this.enableScaleHapticFeedback = true, // 默认启用触觉反馈
  this.onCrossLineTap, // 新增:十字线点击回调
  // 新增:震动效果配置
  this.enableHapticFeedback = true, // 默认启用震动反馈
  this.longPressHaptic = true, // 默认长按震动
  this.crossLineTapHaptic = true, // 默认点击十字线标签震动
  this.scaleHaptic = false, // 默认缩放不震动(避免过于频繁)
  this.boundaryHaptic = true, // 默认边界震动
});