So... here is my table
| Locking | x | x | x | x |
| Public / Private | x | x | x | Default: Private |
now, how do I change it so that certain columns are centered, or that every cell is centered? or just a single cell?
A single cell is centered as following
|=. some-text |
For details see documentation or User Manual.
Update
This is a table example tested on github wiki.
Whole table center
table{text-align:center;}.
table{border:1px solid black; text-align:center;}.
|This|is|a centered table|row|
|This|is|a|row-row-row-row|
Single cell center
|=. centered-cell-text|
table{border:1px solid black; }.
|This|is|a centered table|=. cell|
|This|is|a|row-row-row-row|
Single cell formatting
The cell must start with {css code}. (mind the space).
Outline Every Cell In Every Row Of A Table Using Textile Formatting
E.g.
|_{border:2px solid black}. Provider |_{border:2px solid black}. Text Email Address|_{border:2px solid black}. Verified?|
|{border:2px solid black}. 3 River Wireless|{border:2px solid black}. 10digitphonenumber#sms.3rivers.net |{border:2px solid black}. *Not Verified* |
Try textile in a sandbox: Sandbox: https://txstyle.org/
Related
as the title states, is there a way to conditionally format a text column if it does NOT meet a criteria - In Power BI?
i.e: Format a column's font colour if it is NOT "x".
e.g:
I want to format the following data (using the letter column) and highlight a, b and c (as they are not equal to x)
ID | code | letter
------------------
1 | 123 | a
2 | 345 | b
3 | 567 | x
4 | 789 | c
------------------
You can always create a measure to determine the desired highlight color for example, and use it, e.g. like this:
Measure = If(FIRSTNONBLANK('Table'[letter]; [letter]) = "x"; BLANK(); "#AABBCC")
See Color formatting by field value:
You can use a measure or a column that specifics a color, either using a text value or a hex code, to apply that color to the background of font color of a table or matrix visual. You can also create custom logic for a given field, and have that logic apply the desired color to the font or background.
You didn't mention what do you want to highlight and how. If the data will not be aggregated and show all rows in a table, you can calculate the highlighting color in conditional column in Power Query Editor, or computed column (DAX). If the highlighting rules will be applied on aggregated data, then you should use DAX measure.
If you want to highlight a cell, return the desired color. Otherwise return null in Power Query Editor, or BLANK() in DAX.
I want to subclass a dataframe such that when I do say
df.loc[index,column] = 'green'
the corresponding value specified by [index,column] takes on the value
'background-color: green'
as an example.
Basically I have a lot of custom formatting to do to my dataframes before I send them to excel and since the styler requires storing the styles in dataframes with these strings, I want to create a subclassed dataframe for the styles I am applying to make storing them easier.
I hope my explanation makes sense.
The conditional formatting is no good for me, as a lot of the colors I am getting are being pulled from existing html tables that I have to do a lot of web-scraping to obtain.
Edit: The way the pandas styler object works is that you take a function, which takes the df you wish to style, as an input, and it returns with another dataframe which same index and columns with the style options.
For example I have dataframe
df
A B C D
first second
A1 2 1 3 2 4
A2 2 5 2 2 3
A3 1 3 4 7 6
A4 4 4 3 3 12
A5 6 2 4 4 7
for the values in df that equal two, I want to make their background color blue when exporting this df to excel.
So I'll make a function
def make_2_blue(df):
background_color = pd.DataFrame('',columns=df.columns,index=df.index)
background_color[df == 2] = 'background-color: blue'
return
Then when I want to export this to excel I'd do
df.styler.apply(make_2_blue,axis=None).to_excel('blah.xlsx',engine='openpyxl')
Now in my example I am webscraping html to get the individual cells background color.
What I want to do is subclass a dataframe to make applying these formats easier.
Essentially I would like create some styler-dataframe where I specify the style and then I when I access the individual values in the df it will take in my string and apply the desired formatting.
So lets say I make a background-color dataframe class. I'll make an instance of it called background_color_df.
background_color_df = pd.DataFrame('',index=df.index,columns=df.columns)
>>> background_color_df
A B C \
first second
A1 2 background-color: background-color: background-color:
A2 2 background-color: background-color: background-color:
A3 1 background-color: background-color: background-color:
A4 4 background-color: background-color: background-color:
A5 6 background-color: background-color: background-color:
D
first second
A1 2 background-color:
A2 2 background-color:
A3 1 background-color:
A4 4 background-color:
A5 6 background-color:
Now I go to assign the color blue at a specific index and column
background_color_df.loc['A1','A'] = 'blue'
background_color_df
A B C \
first second
A1 2 background-color: blue background-color: background-color:
A2 2 background-color: background-color: background-color:
A3 1 background-color: background-color: background-color:
A4 4 background-color: background-color: background-color:
A5 6 background-color: background-color: background-color:
D
first second
A1 2 background-color:
A2 2 background-color:
A3 1 background-color:
A4 4 background-color:
A5 6 background-color:
If I got your question right, you have data like this:
color foo
background green bar
foreground red baz
That is, a dataframe with attributes for some kind of category like foreground and background and you need them combined like:
color foo
background background-color: green background-foo: bar
foreground foreground-color: red foreground-foo: baz
Please ignore the column names and index names here, as you could change them easily.
If that is, what you need, you don't need to subclass DataFrame, which will surely be a lot of work. You could just postprocess your dataframe so it looks like what you want. E.g. by doing:
# example data
df= pd.DataFrame({'color': ['green', 'red'], 'foo': ['bar', 'baz']}, index=['background', 'foreground'])
columns_to_transform= ['color', 'foo'] # maybe even: df.columns if you need to transform all columns
for col in columns_to_transform:
df[col]= df.index + '-' + col + ': ' + df[col]
Hi I'm quite new in Pentaho Spoon and I have a problem:
I have a table like this:
model | type | color| q
--1---| --1-- | blue | 1
--1---| --2-- | blue | 2
--1---| --1-- | red | 1
--1---| --2-- | red | 3
--2---| --1-- | blue | 4
--2---| --2-- | blue | 5
And I would like to create a single table (to export in csv or excel) for each model grouped by type with the value of the group as header and as value the q value:
table-1.csv
type | blue | red
--1--| -1-- | -1-
--2--| -2-- | -3-
table-2.csv
type | blue
--1--| -4-
--2--| -5-
I tried with row denormalizer but nothing.
Any suggestion?
Typically it's helpful to see what you have done in order to offer help, but I know how counterintuitive the "help" on this step is.
Make sure you sort the rows on Model and Type before sending them to the denormalizer step. Then give this a try:
As for splitting the output into files, there are a few ways to handle that. Take a look at the Switch/Case step using the Model field.
Also, if you haven't found them already, take a look at the sample files that come with the PDI download. They should be in ...pdi-ce-6.1.0.1-196\data-integration\samples. They can be more helpful than the online documentation sometimes.
Row denormalizer can't be used here if number of colors is unknown, also, you can't define text output fields dynamically.
There are few ways that I can see without using java and js steps. One of them is based on the following idea: we can prepare rows with two columns:
Row Model
type|blue|red 1
1|1|1 1
2|2|3 1
type|blue 2
1|4 2
2|5 2
Then we can prepare filename for each row using Model field and then easily output all rows using text output where file name is taken from filename field. In this case all records will be exported into two files without additional efforts.
Here you can find sample transformation: copy-paste me into new transformation
Please note that it's a sample solution that works only with csv. Also it works only if you have the same number of colors for each type inside model. It's just a hint how to use spoon, it's not a complete solution.
I'm trying to write an application using gtkmm, and I want it to hide the mouse cursor when it has focus. So the first step I tried is I hide mouse cursor when the cursor is on top of my window, which is successful. But to prevent the mouse from showing when it is moved outside of my window, I then restrict the mouse movement by constantly warp the mouse cursor back to the center of my drawing area.
To do this I need to know the window position and the size of the window, which are easy to get using Gdk::Window::get_position and Gdk::Window::get_size. However, if the window is moved, get_position will not return the updated position and thus my cursor will to frozen at a wrong position!
So what are the alternatives to achieve the effect that I want here?
Just grab the pointer.
//pass all events to window apart LEAVE_NOTIFY_MASK
MainWindow->set_events(GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_MOTION_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON2_MOTION_MASK | GDK_BUTTON3_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK | GDK_PROPERTY_CHANGE_MASK | GDK_VISIBILITY_NOTIFY_MASK | GDK_PROXIMITY_IN_MASK | GDK_PROXIMITY_OUT_MASK | GDK_SUBSTRUCTURE_MASK | GDK_SCROLL_MASK | GDK_TOUCH_MASK | GDK_SMOOTH_SCROLL_MASK | GDK_TOUCHPAD_GESTURE_MASK);
MainWindow->set_modal(true);
auto display = MainWindow->get_display();
auto window = MainWindow->get_window();
auto grabSuccess = display->get_default_seat()->grab(window, Gdk::SEAT_CAPABILITY_ALL, true);
if(grabSuccess != Gdk::GRAB_SUCCESS)
{
std::clog<<"grab failed: "<<grabSuccess<<std::endl;
}
How do I build the following view?
I want to build a form using a standard UITableViewController, but I need to have an image that spans the first two rows. Rows have text in them (not pictured).
One way I've considered is to have the Image and first two rows actually be one row with another UITableView embedded inside it, with scrolling disabled.
But I'd really like to do something with indenting.
UITableView
+-----+---------------+
| | | <---+ Row 0
UIImageView +---> | +---------------+
| | | <---+ Row 1
+-----+---------------+
| | <---+ Row 2
+---------------------+
| |
+---------------------+
| |
+---------------------+
| |
+----------------
|
+-----------
|
+------
| Etc..
+--
|
How can I accomplish this, using the fewest widgets / least amount of code (for iOS 4+)?
You've probably realized this isn't standard, so I think your three options are:
Two images that fit to look like one.
rows 1 & 2 are actually 1 row that looks like it's two rows.
row 1 has an image as big as the first two rows, and subview clipping is off so it overlays row two.
I'd be inclined to use option #1, but if the images will change or be dynamic, I might go for option #2
I ended up putting a UIImageView and a nested UITableView inside the row 0 UITableViewCell. The nested UITableView has scrolling disabled and provides one group with two rows. Then I just had to fudge the frame a bit.
I think your best bet would be to subclass UITableViewCell for your first 2 cells. You should be able to lay it out to look like 1 big cell or your rowspanned cells, then just use the default for all the remaining cells.