我有一个我想要按两个属性排序的对象数组:
排序顺序:desc
通过一个属性对此对象进行排序不是问题,但在这种情况下,我不知道如何使其工作.
chart.js 2.6.0
我需要渲染一个如下所示的图表:
始终显示所有工具提示是不可接受的方式,因为它们不会以适当的方式呈现:
不幸的是我找不到解决方案了.我已经尝试了片标签插件,但这有同样的问题,因为它的标签重叠,我无法隐藏某些标签.
这是代码,它使用piece-label创建我的图表以将标签定位在切片上方:
private createStatusChart(): void {
const chartData = this.getStatusChartData();
if (!chartData) {
return;
}
const $container = $(Templates.Dashboard.ChartContainer({
ContainerID: 'chart-status',
HeaderText: 'Status'
}));
this._$content.append($container);
const legendOptions =
new Model.Charts.LegendOptions()
.SetDisplay(false);
const pieceLabelOptions =
new Model.Charts.PieceLabelOptions()
.SetRender('label')
.SetPosition('outside')
.SetArc(true)
.SetOverlap(true);
const options =
new Model.Charts.Options()
.SetLegend(legendOptions)
.SetPieceLabel(pieceLabelOptions);
const chartDefinition = new Model.Charts.Pie(chartData, options);
const ctx = this._$content.find('#chart-status canvas').get(0);
const chart = new Chart(ctx, chartDefinition);
}
private getStatusChartData(): Model.Charts.PieChartData {
if (!this._data) { …Run Code Online (Sandbox Code Playgroud) 如果请求失败,是否有机会从我的respose对象获取其他状态信息?此时,我能够获取状态代码,但此外,我需要状态信息文本(描述错误).如果你正在使用jQuery ajax,你可以从jqXHR的responseText-attribute获取这个文本.
是否存在python请求响应的等价物?
rsp = requests.put(url='{0}recorditems/{1}'
.format(Utils.configuration['service']['baseURI']
, recorditemOID)
, data=body
, headers=headers
, cert=Utils.configuration['daemon']['certFile']
, verify=True)
if rsp.status_code == 200:
Utils.log('Erfassung {0} synchronisiert'.format(recorditemOID))
return True
else:
Utils.log('Status-Code -> {0}'.format(rsp.status_code))
Run Code Online (Sandbox Code Playgroud)