I have the following two texts
text1
a
b
c
d
text2
4
6
1
9
I'm trying to copy the lines from text 2 to text 1 so that it stays as:
a4
b6
c1
d9
the replace and the alt f3 command don't help because they are two different texts.
You can follow this steps:
Select text2 and copy it (Ctrl+C).
Select text1 and get a cursor for every line (Ctrl+Shift+L).
Move all the cursors to the end of their lines (End) and paste (Ctrl+V).
Example
You can use Ctrl+shift+L to get cursors on each line.
Related
this is my code ...please correct so that label will show correct count.
tool tip is showing correct count.
bars =alt.Chart(r).transform_fold(
['Reservation_count', 'ON_ACCOUNT'],
as_=['column', 'value']
).mark_bar().encode(
x='month:N',
y='value:Q',
color=alt.Color('column:N', scale=alt.Scale(range=["#f50520", "#bab6b7"])),
tooltip=alt.Tooltip(['ON_ACCOUNT','Reservation_count']),
)
text = bars.mark_text(
align='left',
color='black',
baseline='middle',
dx=0,dy=-8 # Nudges text to right so it doesn't appear on top of the bar
).encode(
text=alt.Text('ON_ACCOUNT:Q', format='.0f')
)
rule = alt.Chart(r).mark_rule(color='red').encode(
y='mean(Reservation_count):Q'
)
(bars+text+rule).properties(width=490,height=310)
below is my data:
month ON_ACCOUNT Reservation_count
0 1 22 134
1 2 32 137
2 3 22 135
3 4 21 113
4 5 18 120
5 6 17 90
6 7 26 83
7 8 11 86
8 9 11 102
9 10 2 68
please help me with this altair bar chart..two columns are there Reservation_count and ON_ACCOUNT LABEL IS showing the same number for both ...
Thanks
for example last bar showing 2,2 both labels it should be top 2 and bottom 68
The short version answer to your question is to use text=alt.Text('value:Q', format='.0f').
But there are a few more issues with your code:
You are expanding your text layer from the bar plot, which already has the color parameter set. This will ignore the color setting of the text layer.
You can use a data encoding free from any color specification. You can then use this encoding to build your bar and text layers with their color settings.
I encountered the text ordering issue discussed here, and none of the given solutions worked out. However, changing the plot from vertical bar to horizontal bars seem to resolve the issue. This is potentially a bug.
Since you are plotting the mean of Reservation_count parameter on a stacked plot, the information might be misleading. I would suggest a layered bar instead of a stacked one. Surprisingly, this seems to solve the issue of text order.
Here is the code:
base =alt.Chart(r).transform_fold(
['Reservation_count', 'ON_ACCOUNT'],
as_=['column', 'value']
)
bars = base.mark_bar().encode(
x='month:N',
y=alt.X('value:Q', stack=None), # stack =None enables layered bar
color=alt.Color('column:N', scale=alt.Scale(range=["#f50520", "#bab6b7"])),
tooltip=alt.Tooltip(['ON_ACCOUNT','Reservation_count']),
#order=alt.Order('color_Category_sort_index:Q'),
)
text = base.mark_text(
align='center',
color='black',
baseline='middle',
dx=0,dy=-8, # Nudges text to right so it doesn't appear on top of the bar
#order=alt.Order('color_Category_sort_index:Q'),
).encode(
x='month:N',
y='value:Q',
text=alt.Text('value:Q', format='.0f')
)
rule = alt.Chart(r).mark_rule(color='red').encode(
y='mean(Reservation_count):Q'
)
(bars+text+rule).properties(width=490,height=310)
My data is in a format I'd like to change
It has this shape:
Header1,
Data1,
Data4
...
Header2,
Data2,
Data5,
...
Header3
Data3
Data6
...
The end goal is to get my delimited data in a common format (CSV or similar), like:
Header1,Header2,Header3
Data1,Data2,Data3
Data4,Data5,Data6
...
The strategy I was thinking of employing was to join 'distant' lines in vscode by alt-clicking distant lines and then using the Ctrl+Shift+P:Join Lines palette command, but that didn't seem to work.
I was wondering if anyone here knew how to join 'distant lines' in vscode
(or if not that, provide an alternate strategy).
Thanks.
If you have any comma's at the end of a line remove it
Make sure you have the same number of lines under each header
Now for every block
Place the cursor at start of line Header2
Now with Ctrl+Alt+DownArrow add multi Cursors or use Shift+Alt+MouseClick at the last line belonging to Header2
Select the whole line: Shift+End
Cut the content: Ctrl+X
With ArrowUp move the cursors up so the first cursor is on the line with Header1
Got to end of line, Add , , Paste Header2 lines: End , Ctrl+V
You can also start with the last block and add it to the previous block, now the cursors can stay on the same line to pick up the content and move it to the end of the previous block.
At the end remove all the empty lines.
I need to add a list of names in front of a current list of number in sublime and having a hard time figuring out how to do it.
Basically if I have list 1
Tom
Jerry
Mary
Sue
and
12
34
45
39
I need the final text file to read
12 Tom
34 Jerry
45 Mary
39 Sue
I would do it by hand, but its around 800 entries each with about 25 sets of numbers after it.
Thanks!
select list 1
press Ctrl + Shift + L to split the selection into lines
cut the selected lines
select list 2
press Ctrl + Shift + L to split the selection into lines
press End to go to the end of each line & add a space character
paste the previously copied text
Note:
This only works if both selections have the same number of lines.
text
text
text
text
after the editing, those text becomes to
1 text
2 text
3 text
4 text
It's easy in Notepad ++ with the Column Editor, but I don't know how to do the same in Sublime Text 2.
The Text Pastry plugin does the job very well. It offers the Insert Numbers Syntax.
Select multiple lines with CMD+SHIFT+L (Sublime default):
text|
text|
text|
text|
Move the cursor where you want it:
| text
| text
| text
| text
And insert numbers with Text Pastry by hitting CMD+ALT+N and entering 1 space 1 space 0:
1| text
2| text
3| text
4| text
Where 1 space 1 space 0 stands for:
Integer to start with 1
Increment by 1
Padd leading zeros 0
Replace CMD with CTRL on Windows or Linux machines.
copy of this post https://stackoverflow.com/a/64083371/5902698
You want to have a number at each row that you selected, but not the same. For exemple, you select 5 cursors and you want to write 1 2 3 4 5.
select your 5 cursors (maybe you can use the shortcut ctrl + shift + L)
ctrl + shift + P and select arithmetic
Because you have 5 cursors, it propose 1 2 3 4 5
If you want you can change your step of iteration
Or start from an other number than 1
Add even numbers
For this particular case you can use Increment Selection package. Just press Ctrl+Alt+I (Command+Control+I) while having multiple cursors at the beginning of each line.
In addition to melinath answer, here's an example of how to do it:
You will need Package Control first. It shouldn't take more than 30 seconds to install both things.
Steps:
Install Package Control.
Open Command Palette: Ctrl+Shift+P (Mac: Command+Shift+P).
Type Install Package Control and click to install.
Install Increment Selection package.
Open Command Palette again.
Type Package Control: Install Package, click on it and wait a short period.
Type Increment Selection and click on it to install.
Add line numbers to the beginning of each line.
Select all lines with Ctrl+A (Mac: Command+A)
Change selection to multiple lines with Ctrl+Shift+L (Mac: Command+Shift+L)
Go to the start of each line by pressing Home (Mac: Command+←)
Use Increment Selection with Ctrl+Alt+I (Mac: Command+Control+I)
Result:
Other examples for Increment Selection
Increment Selection can also replace numbers, prefix numbers with leading zeroes, increment letters, increment by a step and more.
[1] text [1] text [1] -> 1| text 2| text 3|
[a] text [a] text [a] -> a| text b| text c|
[01] text [01] text [01] -> 01| text 02| text 03|
[05,3] text [05,3] text [05,3] -> 05| text 08| text 11|
[5,-1] text [5,-1] text [5,-1] -> 5| text 4| text 3|
Hint: [] stands for a selection, | stands for a caret.
Featured similar plugins
Selection Evaluator: Evaluate selected mathematical expression with Ctrl+Shift+M (Mac: Command+Shift+M).
The IncrementSelection plugin enables this behavior. If you have Package Control installed, you can just search for and install it. Easy peasy!
Use Emmet package try this :
{$ text${newline}}*4
My simple workaround (up until now when I found this thread) was to go to my spreadsheet editor generate the sequence there, copy, back to subl, expand the cursor over however many lines and paste.
This approach can be applied in any text editor that allows you to expand (clone) the cursor.
You can use the plugin ConyEdit to do this, use its command line cc.abl '#1 ' to append before lines with the contents that you want.
#Nicoolasens This answer is great! Just adding one detail: On macOS you can follow these steps to put a curser at the end of each line:
Use command+A to choose all lines;
Use command+shift+L to put a
curser after each line.
I am using SQL Server 2008 and I want to show 1 single field from a table in multiple columns in the report. Just like if I were to print labels. How can I achieve this?
Example:
Instead of printing:
Names Report
Andrea
Austin
Barbara
Bob
Bruno
Cathy
Chis
...
I want to print in columns (say 3 fixed columns):
Names Report
Andrea ---- Bruno ---- Darren
Austin ---- Cathy ---- Francis
Barbara ---- Chis ---- Gabriel
Bob ---- David ---- Gerald
....... ---- ....... ---- .......
Edit: If I run the report and click on "Print Layout" button, I can see multiple columns. Can I set this mode as default?
For Horizontal layout of labels...
One choice is to use the columns property on the report or body elements.
This doesn't always display correctly On reportviewer. I've noticed that even if it displays correctly on your IDE and when you export to PDF. In the report viewer it will display only one column. Also it snakes the labels top to bottom then left to right.
One choice is to use a matrix and group on every 3 rows (if you want 3 columns).
This one is a little complicated.
My solution of choice is to put 3 vertical lists on the page. put the same label in each list. Return the row number in your dataset. Then just filter each list on modulo 3
For example
Result set
RIndex Fname
1 abe
2 burt
3 fred
4 george
Filter expressions
list 1 -> =Fields!RIndex.Value mod 3 = =1
list 2 -> =Fields!RIndex.Value mod 3 = =2
list 3 -> =Fields!RIndex.Value mod 3 = =0
Result
Abe Burt Fred
George
The method I use is a bit similar as what Vern suggested but differs enough to make it worth mentioning here.
You can combine the ROW_NUMBER with the modulo (%) operator directly in the query to fabricate the column number in which the record should get displayed. Here's an example that generates one while taking a group into account:
declare #numberOfColumns int = 4;
select dpc.EnglishProductCategoryName, dp.ProductAlternateKey
, (ROW_NUMBER() OVER (
PARTITION BY dpc.EnglishProductCategoryName
ORDER BY dp.ProductAlternateKey) + #numberOfColumns - 1) % #numberOfColumns + 1
as DisplayColumn
from dbo.DimProduct dp
inner join dbo.DimProductSubcategory dps on dps.ProductSubcategoryKey = dp.ProductSubcategoryKey
inner join dbo.DimProductCategory dpc on dpc.ProductCategoryKey = dps.ProductCategoryKey;
To get this displayed I'm using nested tables which are then filtered on DisplayColumn.
Have a read through following article for all the details: Creating Multiple-Column Reports
Use the 'Report' menu in Visual Studio and select 'Report Properties'. You can set columns in the 'Layout' tab.
Try this msdn article about newsletter-style reports for more details: http://msdn.microsoft.com/en-us/library/ms159107.aspx
This method does have a limitation though so in some cases it might not be applicable:
Only PDF and Image renderers support
newsletter-style reports.
EDIT:
So one approach is to use multiple tablix with a filter that checks RowNumber and accordingly displays particular records in each table.
The other way is called Newsletter-style report (link). This formatting is retained only when report is exported as PDF or Image. It can be previewed only when you select 'Print Layout' on the Preview tab in Visual Studio. Here is an example:
Create a new report with the foll. dataset: SELECT ID,NAME FROM TABLENAME
Add a new table to the report and select the ID and Name as columns
Click on the tablix and press F4 to edit the tablix properties. In the properties window, change the Size - set the width to 2in
Click on the report area outside the report page boundary and press F4 to edit the report properties. In the properties window, change the Column value to 3, and column spacing value to 0.1
On the report scroll to the right hand side, you will notice that there are 2 new columns (so totally 3 columns on the report - because you selected 3 in step 4 above). Now click on the margin at the start of the column 2 and pull it further to the left to bring it as close to the column 1. This is only to reduce the need for huge page size.
Right click on the report area outside the report page boundary and select Report Properties. Change the Page Size - Set the width to 10in
Preview the report. Now select the 'Print Layout' tab to see the result. This formatting is retained only when report is exported as PDF or Image.
As noted in points 5 and 6 - since the report body flows into multiple columns, you must ensure that the page size is at-least equal to -> ([Original report body size times the number of columns] + all the column spacing values). Otherwise it will look messy.