关于Rascal绘制带分类文本的柱状图横轴的技术咨询
Great question! Let's start with the context from Towards Visual Software Analytics page 70: back when that document was published, bar charts with categorical text labels on the horizontal axis were indeed marked as "work in progress" in Rascal.
Fast forward to now, Rascal fully supports drawing bar charts with categorical text labels on the x-axis—this functionality has been polished and rolled out in subsequent updates to Rascal's visualization libraries.
To put this into practice, you can use the barChart function from the vis::charts module, which natively accepts categorical keys (like custom data types, strings, or enums) as x-axis labels. Here's a simple, actionable example:
import vis::charts; // Define custom categorical categories (or use plain strings directly) data Department = Engineering | Marketing | Design | Support; // Sample data mapping categories to numeric values map[Department, int] teamSizes = (Engineering: 22, Marketing: 14, Design: 8, Support: 10); // Generate the bar chart with categorical x-axis labels barChart( teamSizes, xLabel="Departments", yLabel="Number of Employees", title="Company Team Size Breakdown" );
If you run into any hiccups, make sure you're using the latest version of Rascal's visualization module—older versions might still lack this fully implemented feature.
内容的提问来源于stack exchange,提问作者Jorgos Korres

