This values.Hi! Please tell me how to change these values ? I need a chart that will display price changes , since the spread is small , I want to make a zoom for example from 18.0 to 20.0 , how do I change this? Thank you!
You use the .chartYScale modifier:
Chart {
//your chart stuff here
}
.chartYScale(domain: 18...20)
Related
I want to create a forest plot with the metan ado in Stata. This works fine so far - but I can't solve two problems:
How do I manage that the value range on the x-axis does not already start at the headings but afterwards?
How do I label the column on the far right with "p-value"?
Can someone assist with this?
The code I used is:
metan or_num lci_num uci_num, label (namevar=Variable) by(sort_variable) xlabel(0,1,2,3,4,5,6) xsize(10) ysize(8) null(1) effect(Odds ratio) labtitle(Subgroup) nohet nobetween nooverall nosubgroup nosecsub lcols() rcols(p_num) astext(40) boxscale(0)
I would like to change drawDirection property in donut chart
Please see this: https://www.shinobicontrols.com/docs/ShinobiControls/ShinobiCharts/2.8.7/Standard/Normal/html/Classes/SChartDonutSeries.html
this is part of the code I am referring to:
typedef NS_ENUM(NSInteger, SChartRadialSeriesDrawDirection) {
SChartRadialSeriesDrawDirectionAntiClockwise,
SChartRadialSeriesDrawDirectionClockwise
};
#interface SChartDonutSeries : SChartRadialSeries
#pragma mark -
#pragma mark Drawing the series
/** #name Drawing the series */
/** The direction in which data is drawn around the centre of the plot.
- SChartRadialSeriesDrawDirectionClockwise: Configures the direction in which the data is drawn around the center of the plot to be clockwise.
- SChartRadialSeriesDrawDirectionAntiClockwise: Configures the direction in which the data is drawn around the center of the plot to be anticlockwise.
This defaults to `SChartRadialSeriesDrawDirectionAntiClockwise`.
*/
#property (nonatomic) SChartRadialSeriesDrawDirection drawDirection;
#end
this is my code:
let donutSeries = SChartDonutSeries()
donutSeries.drawDirection = SChartRadialSeriesDrawDirection.SChartRadialSeriesDrawDirectionClockwise
How can I do that in swift 3?
DISCLAIMER I am a developer at ShinobiControls.
You can set the draw direction of your pie or donut series in Swift 3 with the following code:
pieSeries.drawDirection = .clockwise
Make sure you are using the latest version of our framework (which is currently 2.9.3).
Let me know if you have any questions.
I figured out that I can set it like this:
donutSeries.drawDirection = SChartRadialSeriesDrawDirection(rawValue: 1)!
If there is any better way to do it please let me know.
I am working with Google Charts. I need to add a '$' before the values on the y-axis as well as the value in the bubbles.
Is there a setting for this?
take care,
lee
UPdate,
Here is the data being used by the charts:
'Month','Semi-Detached in Toronto E04','Semi-Detached in Toronto E08','Condominium Townhouse in Toronto E04','Condominium Townhouse in Toronto E08', ],
['7/2011', 4354000,15305800,6776500,495000],['8/2011', 700000,10514418,7060786,0],['9/2011', 6854800,17805400,12087300,0],['10/2011', 7287400,14248900,16206500,0],['11/2011', 2696245,9733270,12698090,0],['12/2011', 1965800,6054500,8854390,0],['1/2012', 2450968,9012200,5500100,0] ]);
I've tried adding '$' before the values as well as '%24' as suggested before, but both throw syntax errors. And the values cannot be quoted without throwing a Google Charts error '
Data column(s) for axis #0 cannot be of type stringĂ—'.
Thanks everyone for your input. I found a question that was 99.9% the same:
How to set tooltips to display percentages to match axis in Google Visualization Line Chart?
Try using %24 which is the urlencoded form for $.
Use:
var formatter = new google.visualization.NumberFormat({prefix: '$'});
Check the example here:
https://developers.google.com/chart/interactive/docs/examples#interaction_example
More details here:
https://developers.google.com/chart/interactive/docs/reference#numberformatter
I am try to introduce a Second CursorX at AxisX Primary if this is possible some how?
I did try to activate a second CursorX at Secondary but that one did not work as expected,
I also readed about Line Annotation and Vertical Line Annotation and created some kind of line but a Second set of CursorX CursorY would be far nicer
I did try to create and as much as empty as possible and Transparant Second ChartArea which i try to overlay on top of the ChartArea1, i noticed InnerPlotPosition and Postion of both ChartArea should stay in track to get a full aligned Overlay, and next the CursorX of second ChartArea should be displayed on top of ChartArea1
This is what i think how it could be done but don't have a clue if it sounda for a good way to create a second CursorX maybe Line Annotation is an easier road to rome
Any help suggestion are welcome
Thanks in advance
Suppose your chart contains multiple chart areas aligned vertically, below code allows you set CursorX in each chart area:
Dim c1 As New Chart
'...here code block to build each chart area ...
'...then use below sample code to align each chart area vertically:
'c1.ChartAreas(i).AlignmentOrientation = AreaAlignmentOrientations.Vertical
'c1.ChartAreas(i).AlignWithChartArea = c1.ChartAreas(0).Name
'below set horizontal cursor (it is a gold vertical bar in each chart area):
For Each area As ChartArea In c1.ChartAreas
area.CursorX.LineColor = Color.Gold
area.CursorX.LineWidth = 3
area.CursorX.IsUserEnabled = True
area.CursorX.IsUserSelectionEnabled = True
area.CursorX.SelectionColor = System.Drawing.Color.PaleGoldenrod
Next
The tooltips can be set to display percentages using the following code:
var formatter = new google.visualization.NumberFormat({
fractionDigits: 2,
suffix: '%'
});
formatter.format(data, 1); // Apply formatter to first column.
Is there a way for NumberFormat to multiply each element by 100? Otherwise the tooltip appears as .50%.
I am using vAxis.format = "format:'#%' " which does multiply by 100. So .5 is displayed as 50% on the vertical axis.
According to the documentation(icu-project.org/apiref), this can be overwritten by enclosing the % in single quotes, but this did not work.
The net result is that the tooltips do not match the axis. What is the best way to do this?
I got this working by specifying a formatter exactly as you do:
var chartData = google.visualization.arrayToDataTable(tableData);
var formatter = new google.visualization.NumberFormat({
fractionDigits: 2,
suffix: '%'
});
formatter.format(chartData, 1);
The 1 in the last call means the second column, in which I have float values.
Then I specify a format for the axis in the chart options, escaping the percentage sign as pointed out by documentation and others here:
var chartOptions = {
vAxis: { format: '#\'%\'' }
};
I then draw the chart:
var chart = new google.visualization.ColumnChart(document.getElementById('chart'));
chart.draw(chartData, chartOptions);
This renders a left side axis with values like 10%, 20% and so on. And the tooltips looks like the default one but with a percentage like 10.10%, 20.20% and so on.
If you want two fraction digits in the left side axis as well, use this as format in the chart options instead:
vAxis: { format: '#.00\'%\'' }
var formatter = new google.visualization.NumberFormat({
pattern: '#%',
fractionDigits: 2
});
Thanks to http://groups.google.com/group/google-visualization-api/
You must surround the percent (%) symbol itself in single quotes.
The line I used to do this looks like this: options['vAxis'] = {'format': "#,###'%'"};
Combining this with your formatter above, you can make the vertical axis have a percent symbol and also make the tooltip include it too.
Ok... So this is a little late. I admit I didn't need this seven years ago. Nevertheless, this worked for me.
var rows = data.getNumberOfRows();
for (var i = 0; i < rows; i++) {
data.setFormattedValue(i, 4, (data.getFormattedValue(i, 4)*100).toFixed(1) + "%"); //LY
data.setFormattedValue(i, 3, (data.getFormattedValue(i, 3)*100).toFixed(1) + "%"); //TY
}
In my case, I am using four columns, two of which are assigned to the right axis with percentages. I wanted those columns' tooltips to reflect the proper percentage rather than the decimal representation.
Here is a link to the Google docs:
https://developers.google.com/chart/interactive/docs/reference#DataTable_setFormattedValue
I hope this helps some random stranger looking for it. ;)