I have some data similar to the following chart:
http://developer.yahoo.com/yui/examples/charts/charts-seriescustomization_clean.html
Only difference is that for each of the fields - I have some other extra data - say For utlilities - I have a cash reserve for utility - as another field. I would prefer this data point to come above the utilities bar.
I have been trying from morning to get this chart working, but I am unable to do so. Could you please let me know if it is possible - someway?
Thank you very much in advance.
Regards
K
All data that is positive will appear above the origin so any positive data will be above the utilities bar. If you are trying to get your field to appear directly above the utilities bar, you cannot accomplish his with a column chart. You can do this with the stacked column chart. When using the stacked column chart, all items will be stacked. You can convert the above link to a stacked column by changing your chart constructor from ColumnChart to StackedColumnChart:
var mychart = new YAHOO.widget.StackedColumnChart
and by setting stackingEnabled to true on your vertical axis.
currencyAxis.stackingEnabled = true;
Tripp
Related
My source is generating an agent called Sitz with several parameters which get their value out of a database. One of the parameters is product_type.
Now I would like to count and illustrate the number of Sitz for each product_type in bar chart.
I am thinking of a bar chart which shows 2 bars, one with Sitz product_type = A400S and one with Sitz product_type = A660.
My idea is to write something like sink.count(agent.product_type = "A400S") as value in the bar charts data section, but this is not the right way. What would be the right code?
There are a ton of ways, here is one:
First, create a variable countA440S. Then, in the sink, write
if (agent.product_type.equals("A400S")) {
countA440S++;
}
In your bar chart, link it to the variable as below:
PS: Best always check the example models first, many show how to apply these basic techniques
I have a pie chart in Data Studio as below:
As you can see from the donut, there is "others" slice which I don't want to see it there, and I want to customize the label to show "python (88%)".
Can anyone share your expertise and enlighten me on how to do it?
Thank you very much.
UPDATE
Following #Jaishree's suggestion, I have selected only the top 10, so there is no "others" now.
however, I still don't get it on how to show the label as "python (88%)"
As you can see, I have two fields in my data source (the table on the left): Category and TagsTotal. There is NO percentage_field.
To show "percentage", all I need to do is switch to "percentage" in the STYLE option:
What I ended up of creating this customized labeling is detailed below for future readers:
Back to the data source, create another field pctg:
round((TagsTotal * 100 / (Select Sum(TagsTotal) From cte)),2) as pctg
for the donut chart, create a new field named my_label
CONCAT(category," (",pctg ,"% )")
add the new field my_label as the Dimension field
change in STYLE to show "label"
Voila!
Very cumbersome but finally kind of working with the rest to be sorted out:
1. The newly created field is not showing up in the right-side panel as an available field and how to modify it?
2. The legend needs to be customized to display two lines instead of showing a pagina
In Pie chart and donuts chart you can only show 20 slices. The chart shows the results in a sorted way. If you do not want to see others, then you have select only 20 data points.
"python (88%)" If you want to show the labels as "python (88%)" you can add a new field and customize the labels as you want.
You can do that by click on "create new field " then "add new field" and then give a name to the new field in formula type the below code:
CONCAT(category," (",percentage_field,"% )")
To use the above formula you have to create a percentage_field also before, in the same way with percentage formula.
In my application I want to display some data on a pie chart. I'm using the MPAndroidChart library and following the documentation I managed to program a nice looking chart with all my data correctly displayed.
Now, I'd like to improve my chart, but I'm having some trouble. My data refers to a single day, but there are two categories: incomes and revenues. Until now I've handled them as a single PieDataSet (they have labels, so it is quite easy to distinguish among them). Now I'd like to differentiate among incomes and revenues, to show them with different colors in the same pie chart.
I tried following this link (the line chart part) adapting it to pie charts, but Android Studio tells me that I can't use a List<IPieDataSet> as parameter for a constructor of a PieData object. Here is the code:
public static void drawPie( List<PieEntry> entriesU, List<PieEntry>entriesE, PieChart chart){
PieDataSet set = new PieDataSet(entriesU,"uscite");
PieDataSet set1 = new PieDataSet(entriesE,"entrate");
List<IPieDataSet> dataSets = new ArrayList<>();
dataSets.add(set);
dataSets.add(set1);
set.setSliceSpace(5);
set1.setSliceSpace(5);
PieData data = new PieData(dataSets);
chart.setData(data);
}
I've searched a lot but I still haven't found an answer to this problem.
Question:
It is possible to display multiple data sets on the same pie chart or not? And if it is possible, how can I do it?
A pie-chart is a single 360-degree circle where slices represent percentages of a total of a given dataset. This only makes sense in the context of a single IDataSet. Therefore, unlike BarChart and LineChart, a PieChart doesn't support multiple IDataSet.
I think what you really want is to use different colors for your "incomes" and "revenues". To do this, all you need to do is create a List<Integer> of resolved colors (not color resources) where the position in the list matches the order the PieEntry is added to the chart.
To illustrate, let's say we have this:
entries.add(new PieEntry(15f, "entrate1")); //revenue1
entries.add(new PieEntry(20f, "uscite1")); //expense1
entries.add(new PieEntry(10f, "entrate2")); //revenue2
entries.add(new PieEntry(50f, "uscite2")); //expense2
You just create a List<Integer> of resolved colors that matches that:
List<Integer> colors = new ArrayList<Integer>();
colors.add(ContextCompat.getColor(context, R.color.red));
colors.add(ContextCompat.getColor(context, R.color.blue));
colors.add(ContextCompat.getColor(context, R.color.red));
colors.add(ContextCompat.getColor(context, R.color.blue));
dataSet.setColors(colors);
Now all your revenues are red and your expenses are blue. You can even be clever and write a function that maps PieEntry to colors rather than do it manually.
In any case, this answer here is correct for setting colors for the pie chart slices.
Plain and simple, is it possible to do a bar chart like this one.. using google chart ?
I have no code to show you because is very simple to do bar chart but not sure if is possible to generate a difference arrow. (this graph is from Think Cell)
The closest thing I am aware of is Diff Charts. They aren't nearly as explicit in marking the change, but they are a way to visually display the change in a data set.
Using DiffCharts requires to separate google.visualization.DataTable instances with the old data an new data. You then call the computeDiff(oldData, newData) method on the chart instance and it will give you a new DataTable instance that you can use to draw the diff chart.
I am making an application in iPad which is based on creating pie chart after detecting marks like 280 out of 400. I have to create pie chart based on that marks which shows total marks and also obtain marks.
If someone has an idea about it please let me know.
Take a look at CorePlot's CPTPieChart class
Refer MIMChart-Library which has differnt styles in each category.