Using "role:'annotation'" to place text vertically - google-visualization

I have used the rotate:90, styles and other attemps.
data.addColumn({type:'string', role:'annotation'});
Please see image:
There is the "annotations:{style:'line'}" option but it does create a unsightly middle centered line.. That's not what I want.. I just want to rotate the text 90º.

Related

Coloring a table in apache superset

I want to color the background bars (or the entire cells) of the table as shown in the appended screenshot based on the "Group-By"/dimension value (red for "rot", yellow for "gelb" and green for "grün").
I was able to color the metric-part of other visualizations with label_colors, but I have not yet found a way to color the cells of the table based on a "dimension".
Is there a way to do this?
As of now:
EDIT: I wanted to color it the following way (edited with paint):
This is a tad hacky, but you can add a markdown component and add the following markup:
<style>
th {
color: red; /* or whatever color/hex code you want */
}
</style>
The markdown component will be blank after you add this--i.e. there will just be a blank markdown block-- so you may want to add some copy. Alternatively, if you already have a markdown block, you can add it there, and it won't appear as long as you remember the <style></style> tags.

Change color of labels on x-axis of a Google Chart timeline view

I'm trying to change the color of the black labels on the x-axis. Now they're black, which don't go well with the background. In the documentation I only found: rowLabelStyle or barLabelStyle. How can I change the color of the labels on the x-axis?
By using this CSS:
#timeline text {
fill: #dddada;
}
The text appears light.

Changing color of 3D columns in Google Chart

I am using Google Chart to graph some data, and I want to customize colors. I also would like to use 3D bars (which means I cannot use core library BTW).
This is a screencap of the results I am getting:
Left is the original 3D chart, right is the customized one. As you can see, no shading is applied to the color I define for the 3D effect, instead a flat color is used for the whole column.
Is there any way to fix this?
PS. this is the code I use to geneate the charts:
function drawChartCoste(){
// Create the data table.
var data = new google.visualization.DataTable();
data.addColumn('string', 'Valor');
data.addColumn('number', 'Grupo1');
data.addColumn('number', 'Grupo2');
data.addRow(['Consumo', 2.5, -17.860);
// Set chart options
var options = {'title':'Comparativa de coste',
'width':400,
'height':300,
'is3D':true,
'colors':['#C26900','#165C04']};
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
While I firmly restate my opposition to 3d charts, it would seem that this is doable from this line in the Docs:
If is3D=true, this is an array of either HTML colors, or objects of this type: {color:face_color, darker:shade_color} where color is the element's face color, and darker is the shade color. However, if you specify an HTML color for a 3D object, face and shade will be the same color, and the 3D effect will be reduced. Example: {is3D:true, colors:[{color:'#FF0000', darker:'#680000'}, {color:'cyan', darker:'deepskyblue'}]}
Here is a sample:
// Set chart options
var options = {'title':'Comparativa de coste',
'width':400,
'height':300,
is3D:true,
colors:[{color:'#C26900', darker:'#B15800'}, {color:'#165C04', darker:'#054B00'}]
};

MSChart HowTo Create a Second CursorX to have multiple Cursor by a second Transparant ChartArea?

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

Is there any way to add gridlines to a gRaphael line chart?

I have a line chart that I've created with gRaphael. It has axes and tick marks, but I'd like to have grid lines. Is there built-in way to achieve this or an add on library that can help me?
gRaphael does not have a built-in way to add grid lines, but it is pretty easy to draw them, either by editing the source code or manipulating your graph object after you create it.
I had found an extension called RaphAlytics and used its drawGrid() function in cases where I needed a bounding box with a grid.
You can adapt this function for any gRaphael graph as needed to draw gridlines. On a line chart, I needed to draw horizontal gridlines that were aligned with the left axis marks on a line chart, so I used the function as an example like this:
// Draw horizontal gridlines
for (var i = 0; i < g.axis[1].text.items.length; i++) {
r.path(['M', x, g.axis[1].text.items[i].attrs.y, 'H', w + x]).attr({
stroke : '#EEE'
}).toBack();
}
Here's a working fiddle to illustrate that example: http://jsfiddle.net/KM3BB/1/
I tried doing this yesterday. Short answer: gRaphaël can't do this for you with any linechart options nor axis options, you have to do-it-yourself with Raphaël.
Something like:
var r = Raphael("holder"), txtattr = { font: "12px sans-serif" };
r.path('M 15 200.5 L 310 200.5 M 15 180.5 L 310 200.5');
r.linechart(10, 10, 300, 220, x, [y, y2, y3]);
This means under my linechart draw a path which starts from 15,200.5 and draws a straight line to 310,200.5 moves to 15,180.5 and draws a line to 310,180.5. Don't ask me why but the .5 is important for getting the stroke to actually be 1px wide and solid black. Otherwise it seems to get aliased to 2px wide at 50% opacity. You have to calculate the exact placement in regards to your linechart yourself.
You can also play with the path function in the playground by changing r to paper.
You might also consider looking at Google Chart Tools if your looking for things like defining the exact range of the axis (as opposed to just the min and max of the input).