Ms-Chart Label Format Question - c#

I created a PieChart with the new Ms Chart Controls. How can I format the Labels (Point Values inside the Pie) like the folllowing: "LabelName AbsoluteValue (Percentage)"? For example: "Usa 856027 (56 %)".
Is this possible with the right format information in LabelFormat alone (How?) or do I have to use a custom label format (How?) ?
Thank you very much!
Rupert Rand

You can include keywords in the Label property, which can either be set in the GUI(through the Series Collection Editor) or in code. I would recommend setting it through the GUI since it would not require a full knowledge of the available keywords. If you instead want to set it in the code, it would look similar to this (assuming I understand what format you are requesting): Chart.Series(0).Label = "#ValX #Val (#ValPercentY{P0})".

Related

C# LocalReport change textbox location

How can I change position in LocalReport of any object. Like TextBox or Image and so on. For example try to change Left coordinate.
I was try this way:
ReportParameterCollection reportParameters = new ReportParameterCollection();
reportParameters.Add(new ReportParameter("ReportParameter1", "ValueFromCode"));
report.SetParameters(reportParameters);
but i can't establish a link between reportParameters and location of element.
You can use expressions to dynamically assign values to properties. For instance, if you open a TextBox properties, go to Alignment, and then click on Fx - located to the right of the Left padding field for instance - the expression editor will open.
There, you can select some report parameter like the ReportParameter1 from your example. This would be translated into the following .rdlc code inside the Style tag of the corresponding TextBox:
<PaddingLeft>=Parameters!ReportParameter1.Value</PaddingLeft>
Your ValueFromCode may be something like 10pt, or some numeric value instead, to which you may then append the units, for instance:
<PaddingLeft>=Parameters!ReportParameter1.Value & "pt"</PaddingLeft>
Now, this example is for padding, which you can edit using the designed. I haven't tried it, but in order to set the location dynamically you may be able to do the same for the Top and Left properties of the TextBox (or the desired element), by manually editing the .rdlc file. Give it a try.

Make dates in datetimepicker grey?

Im writing a hotel booking system with VS2012 which uses ms sql and in the booking i have two datetimepicker controls. When i select a date in the first one the date automatically gets transfered to the second datetimepicker. I now want when the user opens up the second datetimepicker not being able to select a date that is before the first date from the first datetimepicker. I dont want to use if method displaying a message i just want the dates to be "greyed" out.
Is that possible and how?
*edit (screenshot of how i would like it to be viewed or similar http://i43.tinypic.com/2zpimvs.jpg )
*edit2: its not the control(dateTimePicker2) it self i want to grey out, its the dates inside it that is smaller then the date selected in dateTimePicker1. The screenshot provided is in the area of what im looking for.
You could try this:
DateTimePicker2.MinValue = Convert.toDateTime(DateTimePicker1.SelectedDate);
EDIT
Standard controls don't support the grey-out of a datetimepicker. If you want to do this, you need to subclass the datetimepicker or look at a premade control like a DateEdit from devexpress (i think they even have free controls).
Change the second datepicker MinDate to first DatePicker selected date .. like below ..
rdpDatePicker2.MinDate = rdpDatePicker1.SelectedDate.Value;

Asp.net chart control IsValueShownAsLabel and label will display values with $ symbol

I have set IsValueShownAsLabel to true in asp.net chart control.
I am trying to show these visible lables as $100.00 instead of showing only numerics like 100.00 or so.
Is there any way as I understand that only numerics can be visible as lables.
chartSeries.LabelFormat = "${0.00}";
solved my problem
Edit:
The most professional way with hints from prthrokz's comment to the question.
chartSeries.LabelFormat = "{0:C}";

.NET Charting Controls: Label values from data source

I know that you can use keywords with labels, but is there any way to use a specific value from my data set as a label? What I would like to do is have a column of my data table contain a custom label string, so that each X-axis value graphed would have a unique label, but it seems there is no way to connect a series to an element from my data source. Is there a workaround to this, or will I just have to manually add labels over the chart?
I believe you are looking for setting a label for your datasource which is different from the columns which derive the X and Y values.In that case you can do this in the following manner
Chart1.Series[0].Points.DataBind(data, "XValue", "YValue",
"ToolTip=mytooltip,Label=LabelColumnName");
Here you can specify the column name against Label which would be used to display the label, in the same fashion you could also set up the tooltip from a different property.
If this is not you are looking out then please update the question with more details.
EDIT
you can set the position of the label using CustomProperties of the series
Chart1.Series[0].CustomProperties = "LabelStyle=Left"; Check this

List of notices, which control is best choice?

I want to use a control to notice users what are happening and what've done. It's like a multiline textbox, each line contains a notice, such as:
Connecting to database...done
Current datetime:
Inserting data into database 10/1000...done
Inserting data into database 20/1000...done
...
Inserted data into database
Current datetime:
I tried textbox, but it seems to be too complicated to manipulate many lines.
Is there a better control to do this? If textbox was the best choice, so how can I do this?
Thanks in advance!
I would use a listbox. Set it to SelectionMode.None. Add to the items collection. If you have enough lines to scroll off the screen you will need to adjust the scrollbar to the bottom manually. Do so by setting the listbox TopIndex to the number of lines - 1.
I've seen people use ListBoxes and TextBoxes. I usually use RichTextBoxes because then I can easily apply some simple styles and colouring, but it's probably overkill.
I found this method in one of my "just-playing-around" projects:
private void writeToLog(String text, SolidColorBrush color)
{
TextRange tr = new TextRange(logTextBox.Document.ContentEnd, logTextBox.Document.ContentEnd);
tr.Text = text;
tr.ApplyPropertyValue(TextElement.ForegroundProperty, color);
}

Categories

Resources