-
-
Notifications
You must be signed in to change notification settings - Fork 753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
请问能做时间不连续的曲线图吗? #363
Comments
可否提供一下这个图表的网页链接地址? |
https://jshare.com.cn/demos/hhhhxi 这个是我期望做的价格效果,查看源代码好巧也是用的Highcharts。。。 左侧可以编辑文字 yAxis: {
labels: {
format: "{value} HK$"
},
} |
Date.UTC(1970, 9, 27)这个其实是一个 JavaScript 当中的function函数,用于返回的一个 double 类型的时间戳 ,但是我 OC 的代码想要实现这个函数对应的功能得到的时间戳不太对,目前还不知道该怎么解决 |
问题已解决,具体改动就在 0cf73ef 这一次 commit 提交的信息当中.如果还需要此功能的话,更新 AAChartKit 的 Demo 值最新版本查看已经添加的示例即可. |
自由配置 AAOptions 实例对象属性,然后再调用 AAChartView 的绘图方法即可 方法1: 1.配置AAOptions实例对象 //Method 1
AAChartModel *aaChartModel = AAObject(AAChartModel)
.chartTypeSet(AAChartTypeLine)//图形类型
.animationTypeSet(AAChartAnimationBounce)//图形渲染动画类型为"bounce"
.titleSet(@"STEP LINE CHART")//图形标题
.subtitleSet(@"2020/08/08")//图形副标题
.dataLabelEnabledSet(NO)//是否显示数字
.symbolStyleSet(AAChartSymbolStyleTypeBorderBlank)//折线连接点样式
.markerRadiusSet(@7)//折线连接点半径长度,为0时相当于没有折线连接点
.seriesSet(@[
AAObject(AASeriesElement)
.nameSet(@"價格")
.colorSet(@"#003386")
.stepSet(@true)
.dataSet(@[
@[AADateUTC(2016, 9 - 1, 2), @389.00],
@[AADateUTC(2016, 10 - 1, 4), @350.10],
@[AADateUTC(2016, 10 - 1, 4), @350.10],
@[AADateUTC(2016, 10 - 1, 17), @389.00],
@[AADateUTC(2016, 11 - 1, 24), @233.40],
@[AADateUTC(2016, 11 - 1, 29), @389.00],
@[AADateUTC(2016, 12 - 1, 20), @233.40],
@[AADateUTC(2017, 1 - 1, 5), @389.00],
@[AADateUTC(2017, 2 - 1, 1), @233.40],
@[AADateUTC(2017, 2 - 1, 9), @389.00],
@[AADateUTC(2017, 4 - 1, 26), @233.40],
@[AADateUTC(2017, 5 - 1, 9), @389.00],
@[AADateUTC(2017, 7 - 1, 19), @291.75],
@[AADateUTC(2017, 8 - 1, 2), @389.00],
@[AADateUTC(2017, 10 - 1, 18), @155.60],
@[AADateUTC(2017, 10 - 1, 31), @389.00],
@[AADateUTC(2017, 11 - 1, 21), @194.50],
@[AADateUTC(2017, 11 - 1, 28), @389.00],
@[AADateUTC(2017, 11 - 1, 29), @194.50],
@[AADateUTC(2017, 12 - 1, 13), @389.00],
@[AADateUTC(2017, 12 - 1, 25), @194.50],
@[AADateUTC(2018, 1 - 1, 9), @389.00],
@[AADateUTC(2018, 2 - 1, 8), @194.50],
@[AADateUTC(2018, 2 - 1, 21), @389.00],
@[AADateUTC(2018, 3 - 1, 8), @155.60],
@[AADateUTC(2018, 3 - 1, 18), @389.00],
@[AADateUTC(2018, 6 - 1, 8), @155.60],
@[AADateUTC(2018, 6 - 1, 18), @389.00],
@[AADateUTC(2018, 7 - 1, 12), @194.50],
// @[Date.now(), @194.50]
]),
AAObject(AASeriesElement)
.nameSet(@"PS+")
.colorSet(@"#FFC535")
.stepSet(@true)
.dataSet(@[
@[AADateUTC(2016, 9 - 1, 2), @389.00],
@[AADateUTC(2016, 10 - 1, 4), @311.20],
@[AADateUTC(2016, 10 - 1, 4), @311.20],
@[AADateUTC(2016, 10 - 1, 17), @389.00],
@[AADateUTC(2016, 11 - 1, 24), @233.40],
@[AADateUTC(2016, 11 - 1, 29), @389.00],
@[AADateUTC(2016, 12 - 1, 20), @233.40],
@[AADateUTC(2017, 1 - 1, 5), @389.00],
@[AADateUTC(2017, 2 - 1, 1), @194.50],
@[AADateUTC(2017, 2 - 1, 9), @389.00],
@[AADateUTC(2017, 4 - 1, 26), @194.50],
@[AADateUTC(2017, 5 - 1, 9), @389.00],
@[AADateUTC(2017, 7 - 1, 19), @194.50],
@[AADateUTC(2017, 8 - 1, 2), @389.00],
@[AADateUTC(2017, 10 - 1, 18), @155.60],
@[AADateUTC(2017, 10 - 1, 31), @389.00],
@[AADateUTC(2017, 11 - 1, 21), @155.60],
@[AADateUTC(2017, 11 - 1, 28), @389.00],
@[AADateUTC(2017, 11 - 1, 29), @155.60],
@[AADateUTC(2017, 12 - 1, 13), @389.00],
@[AADateUTC(2017, 12 - 1, 25), @155.60],
@[AADateUTC(2018, 1 - 1, 9), @389.00],
@[AADateUTC(2018, 2 - 1, 8), @155.60],
@[AADateUTC(2018, 2 - 1, 21), @389.00],
@[AADateUTC(2018, 3 - 1, 8), @155.60],
@[AADateUTC(2018, 3 - 1, 18), @389.00],
@[AADateUTC(2018, 6 - 1, 8), @155.60],
@[AADateUTC(2018, 6 - 1, 18), @389.00],
@[AADateUTC(2018, 7 - 1, 12), @155.60],
// @[Date.now(), @155.60]
]),
]
)
;
AAOptions *aaOptions = [AAOptionsConstructor configureChartOptionsWithAAChartModel:aaChartModel];
NSDictionary *xAxisDic = @{
@"type": @"datetime",
@"dateTimeLabelFormats": @{
@"month": @"%e.%m.%y"
}
};
aaOptions.xAxis = (id)xAxisDic;
return aaOptions; 2.调用绘图方法 [aaChartView aa_drawChartWithOptions:aaOptions]; |
方法2: 1.配置 AAOptions 实例对象 //Method 2
NSDictionary *aaOptions2 = @{
@"title": @false,
@"credits": @false,
@"chart": @{
@"type": @"line",
@"backgroundColor": @"#ffffff"
},
@"plotOptions": @{
@"series":@{
@"animation":@{
@"easing":@(AAChartAnimationLinear),
@"duration":@1000
}
},
@"line": @{
@"color": @"#003386",
@"lineWidth": @1,
@"dataLabels": @{
@"enabled": @false,
@"backgroundColor": @"rgba(255, 255, 255, 1.0)",
@"format": @"{y} HK$",
@"zIndex": @3
},
@"enableMouseTracking": @true,
@"marker": @{
@"fillColor": @"white",
@"symbol": @"circle",
@"lineWidth": @1,
@"lineColor": @"#003386"
}
}
},
@"legend": @{
@"layout": @"horizontal",
@"align": @"left",
@"verticalAlign": @"bottom"
},
@"tooltip": @{
@"shared": @true,
@"shadow": @false,
@"crosshairs": @true,
@"backgroundColor": @"#fff",
@"borderColor": @"#5177b4",
@"borderWidth": @1,
@"xDateFormat": @"%Y-%m-%d",
@"valueSuffix": @" HK$"
},
@"xAxis": @{
@"type": @"datetime",
@"dateTimeLabelFormats": @{
@"month": @"%e.%m.%y"
}
},
@"yAxis": @{
@"title": @false,
@"tickPixelInterval": @40,
@"alternateGridColor": @"#fafafa",
@"gridLineColor": @"#f0f0f0",
@"gridLineDashStyle": @"dash",
@"labels": @{
@"enabled": @true,
@"format": @"{value} HK$"
},
@"min": @0,
@"showFirstLabel": @false
},
@"series": @[@{
@"zIndex": @2,
@"name": @"價格",
@"color": @"#003386",
@"step": @"left",
@"data": @[
@[@1472774400000, @389],
@[@1475539200000, @350.1],
@[@1475539200000, @350.1],
@[@1476662400000, @389],
@[@1479945600000, @233.4],
@[@1480377600000, @389],
@[@1482192000000, @233.4],
@[@1483574400000, @389],
@[@1485907200000, @233.4],
@[@1486598400000, @389],
@[@1493164800000, @233.4],
@[@1494288000000, @389],
@[@1500422400000, @291.75],
@[@1501632000000, @389],
@[@1508284800000, @155.6],
@[@1509408000000, @389],
@[@1511222400000, @194.5],
@[@1511827200000, @389],
@[@1511913600000, @194.5],
@[@1513123200000, @389],
@[@1514160000000, @194.5],
@[@1515456000000, @389],
@[@1518048000000, @194.5],
@[@1519171200000, @389],
@[@1520467200000, @155.6],
@[@1521331200000, @389],
@[@1528416000000, @155.6],
@[@1529280000000, @389],
@[@1531353600000, @194.5],
@[@1532052447381, @194.5]
]
}, @{
@"zIndex": @1,
@"name": @"PS+",
@"color": @"#FFC535",
@"marker": @{
@"lineColor": @"#FFC535"
},
@"step": @"left",
@"data": @[
@[@1472774400000, @389],
@[@1475539200000, @311.2],
@[@1475539200000, @311.2],
@[@1476662400000, @389],
@[@1479945600000, @233.4],
@[@1480377600000, @389],
@[@1482192000000, @233.4],
@[@1483574400000, @389],
@[@1485907200000, @194.5],
@[@1486598400000, @389],
@[@1493164800000, @194.5],
@[@1494288000000, @389],
@[@1500422400000, @194.5],
@[@1501632000000, @389],
@[@1508284800000, @155.6],
@[@1509408000000, @389],
@[@1511222400000, @155.6],
@[@1511827200000, @389],
@[@1511913600000, @155.6],
@[@1513123200000, @389],
@[@1514160000000, @155.6],
@[@1515456000000, @389],
@[@1518048000000, @155.6],
@[@1519171200000, @389],
@[@1520467200000, @155.6],
@[@1521331200000, @389],
@[@1528416000000, @155.6],
@[@1529280000000, @389],
@[@1531353600000, @155.6],
@[@1532052447381, @155.6]
]
}]
}; 2.调用 AAChartView 绘图方法 [aaChartView aa_drawChartWithOptions:aaOptions2]; |
The text was updated successfully, but these errors were encountered: