|
bubble chart |
Posted by Claude Kane on May-25-2013 07:29 |
|
I wish to have a bubble chart as follows:
The X axis is date. The user will be able to select last, Month, Quarter, Year
The Y Axis are not values but Labels - Three rows ?
Row A
Row B
Row C
The size of the bubble will be based on a number and the color will be based on another number. So I want to vary the bubble by size and color based on two different data sets.
I am not sure how set up the Y and X-axis as well as what I want to do with the size and color of the bubble.
Your advice is appreciated. |
Re: bubble chart |
Posted by Peter Kwan on May-28-2013 00:10 |
|
Hi Claude,
For the x-coordinates of the bubbles, you can use an array of DateTime. The range of the x-axis can be anything you like (such as last month, quarter, year, etc). For example, if your user selects "Month", your code can get the data for the last month and use them as the x-coordinates. ChartDirector will auto-scale the x-axis to match your data range. You may use use Axis.setDateScale to set the x-axis scale with your code.
For the y-axis, you may set the y-axis scale from 0 to 6, and use the y-coordinates 1, 3 and 5 for the 3 rows. You may set the labels to anything you like. For example (in C#):
//axis scale from 0 to 6, with 7 labels in the string array
c.yAxis().setLinearScale2(0, 6, new string[] { "", "Row C", "", "Row B", "", "Row A", ""});
For the bubble colors, if you have only a few colors for all bubbles (eg. the colors are for separating the bubbles into different categories), you may separate your data into different colors, and use one bubble layer per color. Alternatively, if every bubble is of a different color, you may use one bubble layer per bubble. It is like:
for (int i = 0; i < myYCoor.length; ++i) {
c.addScatterLayer(new double[] { myXCoor[i] }, new double[] { myYCoor[i] }, "my name", Chart.GlassSphereShape, 15,
myColor[i], myColor[i]).setSymbolScale(new double[] { myBubbleSize[i] });
}
Hope this can help.
Regards
Peter Kwan |
|