我目前在报告仪表板上成功显示饼图.但是,业务请求是为了保留图表大纲,并在所有系列为空时在中心显示"noData"消息.
当图表为空时,业务不喜欢页面上浮动标签的外观.使用现有的图表对象,是否可以基本上制作图表轮廓并显示noData消息?
我尝试做的是在数据表中渲染条形图.我正在使用Highchart和DataTable jquery插件.基本上我想做的就是这个.请看下面的链接.
我有3个列的表,其中一个列中有条形图.该表是可排序的,它具有分页以显示更多行.一切都很难过,有什么办法以某种方式循环图表系列并显示一个用于eatch行.
谢谢您的帮助
我在我的android项目中使用MPChart libarary.我有Json,它包含饼图生成的标签,值和颜色.我想从json到piechart元素设置相同的颜色.我按照MPChart文档,但没有找到饼图颜色设置的任何解决方案.
我有以下情节代码:
var element = document.getElementById(scope.changeid);
function getData(division,redraw) {
var employeeData = [];
if (!division) {
$http.get(api.getUrl('competenceUserAverageByMyDivisions', null)).success(function (response) {
processData(response,redraw);
});
}
else {
$http.get(api.getUrl('competenceUserAverageByDivision', division)).success(function (response) {
processData(response,redraw);
})
}
}
function processData(data,redraw) {
var y = [],
x1 = [],
x2 = [];
data.forEach(function (item) {
y.push(item.user.profile.firstname);
x1.push(item.current_level);
x2.push(item.expected);
});
var charData = [{
x: y,
y: x1,
type: 'bar',
name: $filter('translate')('COMPETENCES.GRAPH.CURRENT'),
marker: {
color: '#23b7e5'
}
}, {
x:y,
y:x2,
type: 'bar',
marker: {
color: '#f05050'
}, …Run Code Online (Sandbox Code Playgroud) 我使用IOS图表来绘制下载速度。我给具有字节值的double的图表函数数组赋值。它建立图表。但是我想在图表标签中显示以兆字节,千字节或字节为单位的值。我可以借助help将这些值转换为字节NSByteFormatter。但是有一个问题,构建图表的函数采用单个值数组(例如字节数组),并在图表上的标签中输出相同的值,我试图找到一种解决方案,但是一无所获。我怎样才能做到这一点?
绘制图表的功能
func setSendChart(description: [String], value: [Double]) {
var chartDataEntryArray = [ChartDataEntry]()
for item in 0..<description.count {
let chartEntry = ChartDataEntry(value: value[item], xIndex: item)
chartDataEntryArray.append(chartEntry)
}
let dataSet = LineChartDataSet(yVals: chartDataEntryArray, label: "")
dataSet.drawCircleHoleEnabled = false
dataSet.drawCirclesEnabled = false
dataSet.drawCubicEnabled = true
dataSet.drawFilledEnabled = true
dataSet.drawValuesEnabled = false
dataSet.fillColor = UIColor(red: 47/255, green: 206/255, blue: 255/255, alpha: 1.0)
let chartData = LineChartData(xVals: description, dataSet: dataSet)
sendChartView.data = chartData
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用chart.js设置图表样式,但无法弄清楚如何禁用图例。同时,我想使用generateLegend()在页面上其他位置设置图例的样式。所以我只想禁用canvas元素内的图例。你们能帮我吗?
这是我的代码:
canvas id="myChart"></canvas>
<div id="legendq3"></div>
<script>
var ctx = document.getElementById("myChart");
var data = {
labels: [
"Red",
"Green",
"Yellow"
],
datasets: [
{
data: [300, 50, 100],
backgroundColor: [
"#FF6384",
"#36A2EB",
"#FFCE56"
],
hoverBackgroundColor: [
"#FF6384",
"#36A2EB",
"#FFCE56"
]
}]
};
var options = {
legendTemplate :'<ul>'
+'<% for (var i=0; i<datasets.length; i++) { %>'
+'</li>'
+'<span style=\"background-color:<%=datasets[i].lineColor%>\"></span>'
+'<% if (datasets[i].label) { %><%= datasets[i].label %><% } %>'
+'</li>'
+'</ul>'
}
var myDoughnutChart = new Chart(ctx, {
type: 'doughnut',
data: …Run Code Online (Sandbox Code Playgroud) 如果我执行以下命令
data(mtcars)
ggplot(data=mtcars, aes(cyl))+
geom_bar(aes(fill=as.factor(gear), y = (..count..)/sum(..count..)), position="dodge") +
scale_y_continuous(labels=percent)
Run Code Online (Sandbox Code Playgroud)
但是,我真正想做的是使每个gear级别的总和达到100%。所以,gear是我正在查看的子组,我想知道每个组内的分布。
我不想使用facets,也不想融合数据。有没有办法做到这一点?
在我的Yii网络应用程序中,Google图表无法正常工作。我正在通过renderpartial方法获取所有值。但是,不显示饼图。
我的代码是
<div class="content">
<div id="graph" style="width:300px;height:300px ">
</div>
</div>
<script type="text/javascript" src="https://www.google.com/jsapi">
// Load the Visualization API and the piechart package.
google.load("visualization", "1", { packages: ["corechart"] });
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(createPIE);
// Callback that creates and populates a data table,
// instantiates the pie chart, passes in the data and
// draws it.
function createPIE() {
var options = {
title: 'Fees Allocation',
colors: ['#888', 'orange','red'],
is3D: true
}; …Run Code Online (Sandbox Code Playgroud) 我有一个数据帧 df
time value
1 08:04 0
2 08:12 0
3 08:20 60
4 08:28 0
5 08:36 0
6 08:44 0
7 08:52 0
8 09:00 0
9 09:08 0
10 09:16 0
11 09:24 0
12 09:32 0
13 09:40 0
14 09:48 0
15 09:56 0
16 10:04 100
17 10:12 49
18 10:20 49
19 10:28 49
20 10:36 0
21 10:44 0
22 10:52 0
23 11:00 0
24 11:08 0
25 11:16 0
26 …Run Code Online (Sandbox Code Playgroud) 假设我们有以下文字
s='i love georgia and its nature';
Run Code Online (Sandbox Code Playgroud)
我想要的是计算每个字母的出现频率(当然不包括空格)和草绘一些图表(例如条形图),首先我创建了使用地图容器计数字母的代码
function character_count(s)
% s is given string and given program will count occurence of letters in
% sentence
MAP=containers.Map();% initialize MAP for frequency counting
n=length(s); % get length of given string
letters=unique_without_space_sorting(s);
for ii=1:n
if ~isletter(s(ii))==1
continue;
elseif isKey(MAP,s(ii) )
MAP(s(ii)) = MAP(s(ii)) + 1;
else
MAP(s(ii)) = 1;
end
end
y=values(MAP);
y= cell2mat(y);
bar(y);
set(gca,'xticklabel',letters)
end
Run Code Online (Sandbox Code Playgroud)
这里的功能
letters=unique_without_space_sorting(s);
Run Code Online (Sandbox Code Playgroud)
返回字符串s的字母数组,没有排序和空格,这里是它对应的代码
function cell_stirng=unique_without_space_sorting(s)
s=regexprep(s,'[^\w'']','');
[~, idxs, ~] = unique(s, 'last');
s= s(sort(idxs));
n=length(s); …Run Code Online (Sandbox Code Playgroud) charts ×10
javascript ×3
highcharts ×2
jquery ×2
r ×2
android ×1
datatable ×1
ggplot2 ×1
graph ×1
ios-charts ×1
matlab ×1
plotly ×1
swift ×1
text ×1
yii ×1