如何创建分解数据图表到类别?
How to create chart of decomposition data to categories?
我正在寻找允许创建如下所示图形的程序或库:
思路如下:
- W有一些初始值
- 分为不同的州
- 这些分裂有时会发生
- 我们想展示与每个州相关的名称和价值
是否可以在 Wolfram Mathematica
中生成这样的图像?如果是,我应该使用哪些功能。
此图片上显示的图表显示了 Tinder 应用程序的使用历史。
来源:
https://www.reddit.com/r/dataisbeautiful/comments/83ttdq/oc_my_28_days_on_tinder/
我决定不用 Mathematica
,而是在 JavaScript
中创建此图。
https://www.amcharts.com/docs/v4/chart-types/sankey-diagram/
/**
* ---------------------------------------
* This demo was created using amCharts 4.
*
* For more information visit:
* https://www.amcharts.com/
*
* Documentation is available at:
* https://www.amcharts.com/docs/v4/
* ---------------------------------------
*/
// Create chart instance
var chart = am4core.create("chartdiv", am4charts.SankeyDiagram);
chart.data = [
{ "from": "A", "to": "D", "value": 10 },
{ "from": "B", "to": "D", "value": 8 },
{ "from": "B", "to": "E", "value": 4 },
{ "from": "C", "to": "E", "value": 3 },
{ "from": "D", "to": "G", "value": 5 },
{ "from": "D", "to": "I", "value": 2 },
{ "from": "D", "to": "H", "value": 3 },
{ "from": "E", "to": "H", "value": 6 },
{ "from": "G", "to": "J", "value": 5 },
{ "from": "I", "to": "J", "value": 1 },
{ "from": "H", "to": "J", "value": 9 }
];
chart.dataFields.fromName = "from";
chart.dataFields.toName = "to";
chart.dataFields.value = "value";
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
#chartdiv {
width: 100%;
height: 300px;
}
<script src="//www.amcharts.com/lib/4/core.js"></script>
<script src="//www.amcharts.com/lib/4/charts.js"></script>
<script src="//www.amcharts.com/lib/4/themes/animated.js"></script>
<div id="chartdiv"></div>
我正在寻找允许创建如下所示图形的程序或库:
思路如下:
- W有一些初始值
- 分为不同的州
- 这些分裂有时会发生
- 我们想展示与每个州相关的名称和价值
是否可以在 Wolfram Mathematica
中生成这样的图像?如果是,我应该使用哪些功能。
此图片上显示的图表显示了 Tinder 应用程序的使用历史。
来源:
https://www.reddit.com/r/dataisbeautiful/comments/83ttdq/oc_my_28_days_on_tinder/
我决定不用 Mathematica
,而是在 JavaScript
中创建此图。
https://www.amcharts.com/docs/v4/chart-types/sankey-diagram/
/**
* ---------------------------------------
* This demo was created using amCharts 4.
*
* For more information visit:
* https://www.amcharts.com/
*
* Documentation is available at:
* https://www.amcharts.com/docs/v4/
* ---------------------------------------
*/
// Create chart instance
var chart = am4core.create("chartdiv", am4charts.SankeyDiagram);
chart.data = [
{ "from": "A", "to": "D", "value": 10 },
{ "from": "B", "to": "D", "value": 8 },
{ "from": "B", "to": "E", "value": 4 },
{ "from": "C", "to": "E", "value": 3 },
{ "from": "D", "to": "G", "value": 5 },
{ "from": "D", "to": "I", "value": 2 },
{ "from": "D", "to": "H", "value": 3 },
{ "from": "E", "to": "H", "value": 6 },
{ "from": "G", "to": "J", "value": 5 },
{ "from": "I", "to": "J", "value": 1 },
{ "from": "H", "to": "J", "value": 9 }
];
chart.dataFields.fromName = "from";
chart.dataFields.toName = "to";
chart.dataFields.value = "value";
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
#chartdiv {
width: 100%;
height: 300px;
}
<script src="//www.amcharts.com/lib/4/core.js"></script>
<script src="//www.amcharts.com/lib/4/charts.js"></script>
<script src="//www.amcharts.com/lib/4/themes/animated.js"></script>
<div id="chartdiv"></div>