How To Highlight a Column in a WinForm StackedColumn Chart - winforms

I'd like to highlight a single column in a WinForm StackedColumn Chart. As examples, I'm seeing how to put borders around the individual DataPoints in each Series displayed in the column and put an ArrowAnnotation pointing at one of the DataPoints, but I don’t see a way to highlight the column as a whole. For example, it would be great to have the column expand to say twice the width of the other columns and/or have a different backcolor (including the empty areas above and below the DataPoints). Is it possible to do what I want and, if so, how? C# examples are preferable but not necessary.
Thanks. Steve

You could dim every other column, using BackHatchStyle = ChartHatchStyle.Percent50 and BackSecondaryColor = Color.Black. This will make your chosen column appear brighter/highlighted.
Here's an example:
int highlightColumnIndex = 0; // Set the highlighted column here!
foreach (Series cs in chart1.Series) {
foreach (DataPoint dp in cs.Points) {
dp.BackSecondaryColor = Color.Black;
dp.BackHatchStyle = ChartHatchStyle.Percent50;
}
cs.Points[highlightColumnIndex].BackHatchStyle = ChartHatchStyle.None;
}
Change chart1 to your chart's name, and change highlightColumnIndex to match the index of the column you want to highlight.
Hope this helps :)

Related

How to remove xTextLabel in a barChart?

The code to draw a bar chart as follows:
XYMultipleSeriesRenderer renderer = buildBarRenderer(colors);
renderer.setXLabels(4);
renderer.setYLabels(4);
ChartLabel chartLabel = getChartLabelfromString(dateL);
for (int i=0; i<chartLabel.labelIdxs.size(); i++){
renderer.addXTextLabel(chartLabel.labelIdxs.get(i),chartLabel.labelStrs.get(i));
}
BarChart chart = new BarChart(buildBarDataset(titles, valueDDL), renderer, BarChart.Type.DEFAULT);
chartLabel.labelIdxs.size() = 4
There are two strange values in the xlabels marked as red color. How do I remove the values 5,10 in the Xaxis?
Barchart Sample Code Output with labels A B C D
There are a number of ways to remove a symbol from your Watchlist.
Using the Links Column
Click on the Links icon.
Select "Delete from Watchlist". The symbol is immediately removed.
It seems you're setting the font size to be relatively large with long labels so they override each other. You can set the angle of the text to fit longer text or you can shrink the font size but there's a limit to what can physically fit under a chart. I suggest just using the month denominator in the labels.
There might be other options since the renderer class includes a lot of them.

How to create little colored shape in a cell that would indicate colors on a chart? SSRS 2012

I have a bar chart with different bar colors. Below in a table I just want to indicate what each color means.
Can I do something like that in SSRS?
Im sure I can create another column on a left and assign each color to a cell. But is any way I can display it the way its on a picture above?
I tried to use indicators for that but I guess it needs conditions.
You can do this with custom code.
Loose steps to follow are:
Create a list to hold the graph
Add the graph
Inside the list and below the graph, add a tablix
The tablix will row group on the same thing as the graph (so you can get a row per coloured item in the graph)
Add a column to the start of the tablix for the colour
Add the following custom code:
Private colourPalette As String() = {"#418CF0", "#FCB441", "#DF3A02", "#056492", "#BFBFBF", "#1A3B69", "#FFE382", "#129CDD", "#CA6B4B", "#005CDB", "#F3D288", "#506381", "#F1B9A8", "#E0830A", "#7893BE"}
Private count As Integer = 0
Private mapping As New System.Collections.Hashtable()
Public Function GetColour(ByVal groupingValue As String) As String
If mapping.ContainsKey(groupingValue) Then
Return mapping(groupingValue)
End If
Dim c As String = colourPalette(count Mod colourPalette.Length)
count = count + 1
mapping.Add(groupingValue, c)
Return c
End Function
For the series fill on the graph, use the follow expression:
Use the same expression for the fill on the initial column in the tablix
You can use any list of codes for colour - this is the list for the default palette in SSRS.
This code ensures the same colour is picked each time the same item is used - so in the image the same colour is returned each time the same Category is returned.
The solution I use is pretty simple.
I use Windows Character Map to find a character I like. For example: ■
Copy that character and add an expression where you want to show the color icon. Your expression text will be
="■"
Then go to the Font tab and Color. Select the color you want from the menu. You can use expression logic in here to change the color dynamically. (You can refer to other answer for details there)

WinForms - Dynamically Add Multiline Textboxes to Panel with Horizontal Scrollbars

I have been given a design that I have to reproduce in Winforms. My attempt is shown below...
At the moment I have 5 static labels and 5 static multiline text boxes to hold my lists of "items"...
But, I need to be able to cope with more than 5 columns...
Not being massively experienced in Winforms, what would be the best way to be able to add additional columns with a horizontal scrollbar to enable the user to scroll from left to right?
I was thinking that maybe a panel, with scrollbars set to Auto, and then dynamically add the titles and text boxes at calculated positions?
Is that possible? Is that the best approach?
Any help would be greatly appreciated.
Thanks
Trev
yes, this looks the way to do it...
this code worked as a test...
int number = 0;
int LocationX = 169;
while (number < 10)
{
// create a new multiline text box
TextBox trev = new TextBox();
trev.Size = txtParent1.Size;
trev.Location = new Point() { X = txtParent1.Location.X + LocationX, Y = txtParent1.Location.Y };
trev.Name = number.ToString();
panelSummary.Controls.Add(trev);
number = number + 1;
LocationX += 169;
}
You could create a view that includes a label and the text box and in the main view you could use a TableLayoutPanel, for every view create a new column and add the view inside the column with Dock set to Fill. This way the resizing and the scrolling is handled by the TableLayoutPanel.
TableLayoutPanel

Freeze 1st, 3rd, 6th column in Telerik RadGrid control in silverlight

I have a RadGrid property to Freeze columns by setting the count.
For ex if i set "FrozenColumnCount="1"" the first column of grid will be freezed. By increasing this count can set that many number of columns freeze.
But i want to do for Different columns like random coulmns.
Please help me on this. Thanks.
You can use the index of the column to do it like this :
myGridView.Columns[1].IsFrozen = true;
myGridView.Columns[3].IsFrozen = true;
myGridView.Columns[6].IsFrozen = true;
Just imagine how the UI behaviour would be when scrolling :)
But you can always first reorder the columns to make the desired columns be the first n ones and then set the FronzenColumnCount to n

Listview image on columns

I have a listview (details view) and I display a column of images and a column of text,
It's possible to display the image in the second column (without OwnerDraw)? I want to put the text in the first because only the first column can be edited by the user (LabelEdit property)
ListViewItem lvi = new ListViewItem("");
lvi.ImageKey = "image"; // column 1
lvi.SubItems.Add("subitem 2"); // column 2
Thank You
UPDATE
Native listview supports images in subitems (LVS_EX_SUBITEMIMAGES) since before win 98 but they didn't include it in .NET.
http://msdn.microsoft.com/en-us/library/windows/desktop/bb774732(v=vs.85).aspx
A codeproject example
http://www.codeproject.com/Articles/7630/ListView-with-Image-on-SubItems
No, without OwnerDraw it is not possible.
In your case the simplest thing is to manage the editing of other columns instead of manage the OwnerDraw. There are some example of how to do it:
example 1
example 2
example 3
ecc...

Resources