This is probably due to a CSS conflict. Add the !important flag to your
background-color:
.PoorTransaction {
font-weight: bold;
color: darkred;
background-color: red !important;
}
On Thursday, June 19, 2014 5:30:08 AM UTC-4, [email protected] wrote:
>
> Hi all,
>
> I'm hoping you can help me.
>
> I've been fighting with google charts for a couple of days and I'm getting
> inconsistent results.
>
> The problem
>
> I have a table that I populate via a call to a java servlet that extends
> the DataSourceServlet class and overrides the generate table method.
>
> @Override
> public DataTable generateDataTable(Query arg0, HttpServletRequest
> request)
> throws DataSourceException {
> }
>
> Anyhoo I create a table of data from a database, this is all working fine,
> i get a nice 'vanilla' table.
>
> Now i want to apply CSS styles to the table cell elements depending on the
> data. (The data i have is transaction performance data so if its missing
> the SLA i want to sent the background of the cell to red or maybe amber)
>
> In my java code i have:
>
> public TableCell formatPoorTxCell(TableCell cell)
> {
> cell.setCustomProperty("className", this.POOR_TRANSACTION_CELL);
> return cell;
> }
>
>
> My page loads CSS with this in it
> .PoorTransaction{
> font-weight: bold; color: darkred; background-color: red;
> }
>
>
>
> When my table is redrawn the text is dark red but background color is not
> set, so it is picking up the fact i change it to my CSS and it only loads
> part of it....
>
> The main part of JS.
>
> function handleQueryResponse(response) {
> if (response.isError()) {
> alert('Error in query: ' + response.getMessage() + ' ' +
> response.getDetailedMessage());
> return;
> }
> // Draw the visualization.
> var data = response.getDataTable();
> var chart = new
> google.visualization.Table(document.getElementById('table_chart_div'));
> chart.draw(data, { allowHtml: true, page:'enable', pageSize:20,
> showRowNumber: false, is3D: false});
> }
>
>
> If i change the java code to do the following:
>
> public TableCell formatPoorTxCell(TableCell cell)
> {
> cell.setCustomProperty("style","font-weight: bold; color: darkred;
> background-color: red;");
> return cell;
> }
>
> The style line is a cut and paste from the CSS file, the page draws it as
> expected with red background.
>
> The problem with this is i dont want to have CSS hard coded inside my Java
> code. I'd rather make it with a className so any tweaks are done via a text
> file rather than having to re-compile the class every time i make the a
> change.
>
> Is this a bug or have I missed something?
>
> Thanks in advance.
>
> Andrew
>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.