- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试根据类型可视化一些评分,但是我很难找到如何根据类型对系列进行分组。
图表选项如下:
$scope.chartOptions = {
dataSource: data,
commonSeriesSettings: {
argumentField: "ratingDate"
},
series: [
{ valueField: "score", group: "Recommend", color: '#66cc33' },
{ valueField: "score", group: "Service", color: '#35a2f4' },
{ valueField: "score", group: "Product", color: '#ef4e3a' },
{ valueField: "score", group: "Experience", color: '#fea000' }
],
argumentAxis: {
grid: {
visible: true
},
argumentType: 'datetime'
},...
系列选项没有group
选项,这是我希望拥有的选项,因为我希望看到一个系列是关于一段时间内的服务得分,一个系列是关于超时的产品得分等.
目前我得到了 4 个不同颜色的重复系列。 Here is a fiddle
The documentation has no information about grouping like this所以我想知道是否有人遇到过这个问题并解决了类似的问题?
也许我可以在其中返回 truMetric == “Recommend” 的分组函数?
我的示例数据如下所示:
var data =
[
{"clientId": 100052, "questionId": 10000, "description": null, "truMetric": "Recommend", "questionCategory": "Recommend", "score": 7.0, "percentageRating": 7.0, "totalNumberOfRatings": 8, "ratingDate": "2014-04-01T00:00:00Z", "categoryId": 10000},
{"clientId": 100052, "questionId": 10000, "description": null, "truMetric": "Recommend", "questionCategory": "Recommend", "score": 7.0, "percentageRating": 7.0, "totalNumberOfRatings": 4, "ratingDate": "2014-04-02T00:00:00Z", "categoryId": 10000},
{"clientId": 100052, "questionId": 10000, "description": null, "truMetric": "Recommend", "questionCategory": "Recommend", "score": 1.6666666666666667, "percentageRating": 1.6666666666666667, "totalNumberOfRatings": 12, "ratingDate": "2014-04-04T00:00:00Z", "categoryId": 10000},
{"clientId": 100052, "questionId": 10000, "description": null, "truMetric": "Recommend", "questionCategory": "Recommend", "score": 6.0, "percentageRating": 6.0, "totalNumberOfRatings": 12, "ratingDate": "2014-04-05T00:00:00Z", "categoryId": 10000},
{"clientId": 100052, "questionId": 10000, "description": null, "truMetric": "Recommend", "questionCategory": "Recommend", "score": 5.333333333333333, "percentageRating": 5.333333333333333, "totalNumberOfRatings": 12, "ratingDate": "2014-04-06T00:00:00Z", "categoryId": 10000},
{"clientId": 100052, "questionId": 10000, "description": null, "truMetric": "Recommend", "questionCategory": "Recommend", "score": 0.66666666666666663, "percentageRating": 0.66666666666666663, "totalNumberOfRatings": 12, "ratingDate": "2014-04-08T00:00:00Z", "categoryId": 10000},
{"clientId": 100052, "questionId": 10000, "description": null, "truMetric": "Recommend", "questionCategory": "Recommend", "score": 2.6, "percentageRating": 2.6, "totalNumberOfRatings": 20, "ratingDate": "2014-04-09T00:00:00Z", "categoryId": 10000},
{"clientId": 100052, "questionId": 10000, "description": null, "truMetric": "Recommend", "questionCategory": "Recommend", "score": 3.0, "percentageRating": 3.0, "totalNumberOfRatings": 4, "ratingDate": "2014-04-10T00:00:00Z", "categoryId": 10000},
{"clientId": 100052, "questionId": 10001, "description": null, "truMetric": "Service", "questionCategory": "Service", "score": 5.0, "percentageRating": 5.0, "totalNumberOfRatings": 12, "ratingDate": "2014-04-01T00:00:00Z", "categoryId": 10001},
{"clientId": 100052, "questionId": 10001, "description": null, "truMetric": "Service", "questionCategory": "Service", "score": 7.0, "percentageRating": 7.0, "totalNumberOfRatings": 8, "ratingDate": "2014-04-02T00:00:00Z", "categoryId": 10001},
{"clientId": 100052, "questionId": 10001, "description": null, "truMetric": "Service", "questionCategory": "Service", "score": 3.8, "percentageRating": 3.8, "totalNumberOfRatings": 20, "ratingDate": "2014-04-03T00:00:00Z", "categoryId": 10001},
{"clientId": 100052, "questionId": 10001, "description": null, "truMetric": "Service", "questionCategory": "Service", "score": 4.0, "percentageRating": 4.0, "totalNumberOfRatings": 8, "ratingDate": "2014-04-04T00:00:00Z", "categoryId": 10001},
{"clientId": 100052, "questionId": 10001, "description": null, "truMetric": "Service", "questionCategory": "Service", "score": 5.666666666666667, "percentageRating": 5.666666666666667, "totalNumberOfRatings": 12, "ratingDate": "2014-04-06T00:00:00Z", "categoryId": 10001},
{"clientId": 100052, "questionId": 10001, "description": null, "truMetric": "Service", "questionCategory": "Service", "score": 3.6666666666666665, "percentageRating": 3.6666666666666665, "totalNumberOfRatings": 12, "ratingDate": "2014-04-09T00:00:00Z", "categoryId": 10001},
{"clientId": 100052, "questionId": 10001, "description": null, "truMetric": "Service", "questionCategory": "Service", "score": 9.0, "percentageRating": 9.0, "totalNumberOfRatings": 4, "ratingDate": "2014-04-10T00:00:00Z", "categoryId": 10001},
{"clientId": 100052, "questionId": 10002, "description": null, "truMetric": "Experience", "questionCategory": "Experience", "score": 4.5, "percentageRating": 4.5, "totalNumberOfRatings": 8, "ratingDate": "2014-04-01T00:00:00Z", "categoryId": 10002},
{"clientId": 100052, "questionId": 10002, "description": null, "truMetric": "Experience", "questionCategory": "Experience", "score": 3.0, "percentageRating": 3.0, "totalNumberOfRatings": 4, "ratingDate": "2014-04-02T00:00:00Z", "categoryId": 10002},
{"clientId": 100052, "questionId": 10002, "description": null, "truMetric": "Experience", "questionCategory": "Experience", "score": 5.333333333333333, "percentageRating": 5.333333333333333, "totalNumberOfRatings": 12, "ratingDate": "2014-04-03T00:00:00Z", "categoryId": 10002},
{"clientId": 100052, "questionId": 10002, "description": null, "truMetric": "Experience", "questionCategory": "Experience", "score": 7.5, "percentageRating": 7.5, "totalNumberOfRatings": 8, "ratingDate": "2014-04-04T00:00:00Z", "categoryId": 10002},
{"clientId": 100052, "questionId": 10002, "description": null, "truMetric": "Experience", "questionCategory": "Experience", "score": 5.5, "percentageRating": 5.5, "totalNumberOfRatings": 8, "ratingDate": "2014-04-05T00:00:00Z", "categoryId": 10002},
{"clientId": 100052, "questionId": 10002, "description": null, "truMetric": "Experience", "questionCategory": "Experience", "score": 0.5, "percentageRating": 0.5, "totalNumberOfRatings": 8, "ratingDate": "2014-04-07T00:00:00Z", "categoryId": 10002},
{"clientId": 100052, "questionId": 10002, "description": null, "truMetric": "Experience", "questionCategory": "Experience", "score": 5.666666666666667, "percentageRating": 5.666666666666667, "totalNumberOfRatings": 12, "ratingDate": "2014-04-08T00:00:00Z", "categoryId": 10002},
{"clientId": 100052, "questionId": 10002, "description": null, "truMetric": "Experience", "questionCategory": "Experience", "score": 2.0, "percentageRating": 2.0, "totalNumberOfRatings": 4, "ratingDate": "2014-04-10T00:00:00Z", "categoryId": 10002},
{"clientId": 100052, "questionId": 10003, "description": null, "truMetric": "Product", "questionCategory": "Product", "score": 8.0, "percentageRating": 8.0, "totalNumberOfRatings": 8, "ratingDate": "2014-04-01T00:00:00Z", "categoryId": 10003},
{"clientId": 100052, "questionId": 10003, "description": null, "truMetric": "Product", "questionCategory": "Product", "score": 6.25, "percentageRating": 6.25, "totalNumberOfRatings": 16, "ratingDate": "2014-04-02T00:00:00Z", "categoryId": 10003},
{"clientId": 100052, "questionId": 10003, "description": null, "truMetric": "Product", "questionCategory": "Product", "score": 3.0, "percentageRating": 3.0, "totalNumberOfRatings": 4, "ratingDate": "2014-04-03T00:00:00Z", "categoryId": 10003},
{"clientId": 100052, "questionId": 10003, "description": null, "truMetric": "Product", "questionCategory": "Product", "score": 0.0, "percentageRating": 0.0, "totalNumberOfRatings": 4, "ratingDate": "2014-04-04T00:00:00Z", "categoryId": 10003},
{"clientId": 100052, "questionId": 10003, "description": null, "truMetric": "Product", "questionCategory": "Product", "score": 3.25, "percentageRating": 3.25, "totalNumberOfRatings": 16, "ratingDate": "2014-04-05T00:00:00Z", "categoryId": 10003},
{"clientId": 100052, "questionId": 10003, "description": null, "truMetric": "Product", "questionCategory": "Product", "score": 1.0, "percentageRating": 1.0, "totalNumberOfRatings": 8, "ratingDate": "2014-04-06T00:00:00Z", "categoryId": 10003},
{"clientId": 100052, "questionId": 10003, "description": null, "truMetric": "Product", "questionCategory": "Product", "score": 6.0, "percentageRating": 6.0, "totalNumberOfRatings": 16, "ratingDate": "2014-04-07T00:00:00Z", "categoryId": 10003},
{"clientId": 100052, "questionId": 10003, "description": null, "truMetric": "Product", "questionCategory": "Product", "score": 2.5, "percentageRating": 2.5, "totalNumberOfRatings": 8, "ratingDate": "2014-04-08T00:00:00Z", "categoryId": 10003},
{"clientId": 100052, "questionId": 10003, "description": null, "truMetric": "Product", "questionCategory": "Product", "score": 3.5, "percentageRating": 3.5, "totalNumberOfRatings": 8, "ratingDate": "2014-04-10T00:00:00Z", "categoryId": 10003},
{"clientId": 100052, "questionId": 10004, "description": null, "truMetric": "Value", "questionCategory": "Value", "score": 2.0, "percentageRating": 2.0, "totalNumberOfRatings": 12, "ratingDate": "2014-04-01T00:00:00Z", "categoryId": 10004},
{"clientId": 100052, "questionId": 10004, "description": null, "truMetric": "Value", "questionCategory": "Value", "score": 5.0, "percentageRating": 5.0, "totalNumberOfRatings": 8, "ratingDate": "2014-04-02T00:00:00Z", "categoryId": 10004},
{"clientId": 100052, "questionId": 10004, "description": null, "truMetric": "Value", "questionCategory": "Value", "score": 8.0, "percentageRating": 8.0, "totalNumberOfRatings": 4, "ratingDate": "2014-04-04T00:00:00Z", "categoryId": 10004},
{"clientId": 100052, "questionId": 10004, "description": null, "truMetric": "Value", "questionCategory": "Value", "score": 4.666666666666667, "percentageRating": 4.666666666666667, "totalNumberOfRatings": 12, "ratingDate": "2014-04-05T00:00:00Z", "categoryId": 10004},
{"clientId": 100052, "questionId": 10004, "description": null, "truMetric": "Value", "questionCategory": "Value", "score": 5.0, "percentageRating": 5.0, "totalNumberOfRatings": 4, "ratingDate": "2014-04-07T00:00:00Z", "categoryId": 10004},
{"clientId": 100052, "questionId": 10004, "description": null, "truMetric": "Value", "questionCategory": "Value", "score": 1.0, "percentageRating": 1.0, "totalNumberOfRatings": 4, "ratingDate": "2014-04-09T00:00:00Z", "categoryId": 10004},
{"clientId": 100052, "questionId": 10004, "description": null, "truMetric": "Value", "questionCategory": "Value", "score": 3.3333333333333335, "percentageRating": 3.3333333333333335, "totalNumberOfRatings": 12, "ratingDate": "2014-04-10T00:00:00Z", "categoryId": 10004},
{"clientId": 100052, "questionId": 99, "description": null, "truMetric": "truRating", "questionCategory": "truRating", "score": 5.0, "percentageRating": 5.0, "totalNumberOfRatings": 48, "ratingDate": "2014-04-01T00:00:00Z", "categoryId": 99},
{"clientId": 100052, "questionId": 99, "description": null, "truMetric": "truRating", "questionCategory": "truRating", "score": 5.9, "percentageRating": 5.9, "totalNumberOfRatings": 40, "ratingDate": "2014-04-02T00:00:00Z", "categoryId": 99},
{"clientId": 100052, "questionId": 99, "description": null, "truMetric": "truRating", "questionCategory": "truRating", "score": 4.2222222222222223, "percentageRating": 4.2222222222222223, "totalNumberOfRatings": 36, "ratingDate": "2014-04-03T00:00:00Z", "categoryId": 99},
{"clientId": 100052, "questionId": 99, "description": null, "truMetric": "truRating", "questionCategory": "truRating", "score": 4.0, "percentageRating": 4.0, "totalNumberOfRatings": 36, "ratingDate": "2014-04-04T00:00:00Z", "categoryId": 99},
{"clientId": 100052, "questionId": 99, "description": null, "truMetric": "truRating", "questionCategory": "truRating", "score": 4.666666666666667, "percentageRating": 4.666666666666667, "totalNumberOfRatings": 48, "ratingDate": "2014-04-05T00:00:00Z", "categoryId": 99},
{"clientId": 100052, "questionId": 99, "description": null, "truMetric": "truRating", "questionCategory": "truRating", "score": 4.375, "percentageRating": 4.375, "totalNumberOfRatings": 32, "ratingDate": "2014-04-06T00:00:00Z", "categoryId": 99},
{"clientId": 100052, "questionId": 99, "description": null, "truMetric": "truRating", "questionCategory": "truRating", "score": 4.2857142857142856, "percentageRating": 4.2857142857142856, "totalNumberOfRatings": 28, "ratingDate": "2014-04-07T00:00:00Z", "categoryId": 99},
{"clientId": 100052, "questionId": 99, "description": null, "truMetric": "truRating", "questionCategory": "truRating", "score": 3.0, "percentageRating": 3.0, "totalNumberOfRatings": 32, "ratingDate": "2014-04-08T00:00:00Z", "categoryId": 99},
{"clientId": 100052, "questionId": 99, "description": null, "truMetric": "truRating", "questionCategory": "truRating", "score": 2.7777777777777777, "percentageRating": 2.7777777777777777, "totalNumberOfRatings": 36, "ratingDate": "2014-04-09T00:00:00Z", "categoryId": 99},
{"clientId": 100052, "questionId": 99, "description": null, "truMetric": "truRating", "questionCategory": "truRating", "score": 3.875, "percentageRating": 3.875, "totalNumberOfRatings": 32, "ratingDate": "2014-04-10T00:00:00Z", "categoryId": 99}
];
最佳答案
var dataSource = new DevExpress.data.DataSource(data);
dataSource.group("ratingDate","truMetric" );
dataSource.load().done(function(result) {
var chart_data=[];
for(var i=0;i<result.length;i++){
var d={ratingDate:result[i].key};
for(var j=0;j<result[i].items.length;j++){
d[result[i].items[j].key]=result[i].items[j].items[0].score;
}
chart_data.push(d);
}
$("#chartContainer").dxChart({
dataSource:chart_data,
// rest of your code
series: [
{ valueField: "Recommend", name:"Recommend", color: '#66cc33' },
{ valueField: "Service", name:"Service", color: '#35a2f4' },
{ valueField: "Product", name:"Product", color: '#ef4e3a' },
{ valueField: "Experience", name:"Experience", color: '#fea000' }
],
//rest of your code
完整 fiddle :http://jsfiddle.net/2Bq9k/1/
关于javascript - 如何在 dx-Chartjs 上创建多个系列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23326935/
有没有办法在 vue-chartjs 中制作带圆角的条形图?我在谷歌上搜索了一下,发现我们可以使用此 url 中给出的渲染条的实现来扩展条形图 - How to put rounded corners
我想通过提供两个数组来创建多条垂直线,第一个称为marketing,其中包含诸如“2017-09-21”等日期和一个数组称为 amount,仅包含数字。 我使用 ChartJS 创建了折线图。最终结果
(对不起我的英语)我将 chartjs-plugin-streaming 用于实时 chartjs,我想使用 chartjs-plugin-zoom。 但是缩放不起作用。 当我测试缩放时,出现缩放区域
我使用 angualr2-chartjs 来显示图表。我的问题是当我动态更改选项时图表更新只有一次。在控制台中,我看到一切都很好,但在 View 中我看不到变化。我使用了 chartjs-plugin
我正在尝试创建类似于 www.chartjs.org 顶部的内容其中有一个随机移动的背景条形图。我发现了另一个类似的question ,但是它似乎不起作用。当我在下面添加时,它不会添加除 400x40
感谢任何提示和/或帮助!我在这里碰壁试图让图表呈现。我已经恢复到测试一个非常简单的方法(下面的代码),但我仍然收到以下错误: 类型错误:无法读取未定义的属性(读取“ map ”) 我可以记录从 use
chartjs-plugin-zoom是 Chart.js 的缩放和平移插件 您可以调用 chart.resetZoom() 以编程方式将缩放重置为默认状态。参见 this example on js
我正在尝试将 Chart.js 与 Vue.js 一起使用,这就是我得到的编译结果,但我没有在 GUI 上看到任何显示。 这是我的文件 DonutChart.vue: // NOT SURE IF
好的,所以我正在尝试通过 VueJS 创建一个 ChartJS 实例,以便我可以通过组件内的 AJAX 请求轻松更新其数据。 基本上它可以工作,创建了 ChartJS 实例,但它是空的,高度和宽度为
我想从 chartjs-chart-treemap 添加树状图到我现有的使用 react-chartjs-2 的项目中. 我到目前为止尝试过: import ChartComponent from '
是否可以定义具有多级别/类别轴的条形图? 例如,我想显示地区/省类别,如下 Excel 图表所示: 我找到了this使用多个 xAxes 的示例。 xAxes:[ { id:'xA
我正在使用 chart.js (V2) 尝试构建一个条形图,用户无需将鼠标悬停在任何地方或点击任何地方即可获得更多信息。我提供了两个示例,说明我希望如何编辑我的图表。 Two edited versi
我想使用 Chartjs(chartjs.org) 作为我的图表工具以及使用 TypeScript 的 AngularJS。我已经从 GitHub 安装了 DefinitelyTyped for Ch
我正在使用 chartjs-plugin-datalabels,并且在大图表中显示较小的数据集时值重叠 这是 chartjs-data-plugin 配置 options: { plu
var yLabels = { 1 : 'New', 2 : 'Learning Phase', 3
我正在创建图表以使用图表 js 呈现一些数据。 const data = { labels: ["1 Dec", "8 Dec", "16 Dec", "31 Dec"], dat
我正在尝试将其他数据插入圆环图中。 Controller 将这样的数组传递给 View : [ 0 => array:3 [ "profit" => 20 "sex" => arr
将百分比值添加到图例标签的最简单方法是什么? 我相信它会使用 generateLabels: function (chart) {},谁能提供一个干净的例子? 最佳答案 似乎没有任何本地方式来显示百分
我已经多次看到这个问题,但我找不到适合我的解决方案。 我将一个 Django 变量传递给 Chartjs 进行绘图,所有的个位数都是正确的,但它将两位数变成了一个。像 11 是 1,1...23 是
我正在尝试使用 chartjs 数据标签插件获取每个条上的值。 所以在条形“a”上方 a 想看到数字 30 及以上或在条形“b”内我想看到数字 50。 但它根本没有显示任何值。 任何人都可以帮助并告诉
我是一名优秀的程序员,十分优秀!