Click here to Skip to main content
15,898,787 members
Home / Discussions / C#
   

C#

 
GeneralRe: Readout datagrid in PowerPoint 2010 and insert datas in new PowerPoint slide Pin
Member 1177535418-Jun-15 10:09
Member 1177535418-Jun-15 10:09 
GeneralRe: Readout datagrid in PowerPoint 2010 and insert datas in new PowerPoint slide Pin
Dave Kreskowiak18-Jun-15 10:15
mveDave Kreskowiak18-Jun-15 10:15 
GeneralRe: Readout datagrid in PowerPoint 2010 and insert datas in new PowerPoint slide Pin
Member 1177535418-Jun-15 10:19
Member 1177535418-Jun-15 10:19 
Questionc#(Invalid attempt to call HasRows when reader is closed)occurred when i was using the following query in 3tier Pin
Member 1129409418-Jun-15 1:19
Member 1129409418-Jun-15 1:19 
AnswerRe: c#(Invalid attempt to call HasRows when reader is closed)occurred when i was using the following query in 3tier Pin
Pete O'Hanlon18-Jun-15 1:26
mvePete O'Hanlon18-Jun-15 1:26 
SuggestionRe: c#(Invalid attempt to call HasRows when reader is closed)occurred when i was using the following query in 3tier Pin
Sascha Lefèvre18-Jun-15 1:46
professionalSascha Lefèvre18-Jun-15 1:46 
AnswerRe: c#(Invalid attempt to call HasRows when reader is closed)occurred when i was using the following query in 3tier Pin
OriginalGriff18-Jun-15 2:21
mveOriginalGriff18-Jun-15 2:21 
Questiondatavisualization - Audiometric chart Pin
Member 1061400017-Jun-15 21:52
Member 1061400017-Jun-15 21:52 
Hello,

i need to build an Audiometric chart like this in c# .net 4
Audiometric chart

x values are: 125, 500, 1000, 2000, 4000, 8000

Consider that the series can have intermediate values, example 750, 3000, 6000.

i tried to use Datavisualization library, i suppose that values are logarithmic but I could not find the correct values.

here's the code

public MemoryStream DrawChart(double baseValue)
{
Chart chart = new Chart
{
Palette = ChartColorPalette.EarthTones,
Width = 1200,
Height = 800,
ForeColor = Color.Black,
BackColor = Color.White,
BorderlineDashStyle = ChartDashStyle.Solid,
BackSecondaryColor = Color.White,
BackGradientStyle = GradientStyle.None,
BorderWidth = 0
};

Series series = new Series("Right")
{
Color = Color.Red,
LabelForeColor = Color.Black,
ChartType = SeriesChartType.Line,
IsValueShownAsLabel = false,
XValueType = ChartValueType.Int32,
YValueType = ChartValueType.Int32,
MarkerStyle = MarkerStyle.None,
// gestione doppio asse x o asse y
XAxisType = AxisType.Primary,
YAxisType = AxisType.Primary,
};

// rende la linea più spessa e più visibile
series.BorderWidth = 6;
series.SmartLabelStyle.Enabled = true;
/*
* valori dell'orecchio destro
*/
series.Points.AddXY(125, 0);
series.Points.AddXY(250, 0);

series.Points.AddXY(500, 10);
series.Points.AddXY(1000, 120);
series.Points.AddXY(2000, 10);
series.Points.AddXY(3000, 0);
series.Points.AddXY(4000, 10);
series.Points.AddXY(6000, 10);
series.Points.AddXY(8000, 20);

chart.Series.Add(series);

//Aggiungo un'area di visualizzazione del grafico corrente
ChartArea area = new ChartArea("Default")
{
BorderDashStyle = ChartDashStyle.Solid,
BackSecondaryColor = Color.White,
ShadowColor = Color.Transparent,
BackGradientStyle = GradientStyle.TopBottom,
BackColor = Color.Transparent,
};

area.AxisY.Minimum = -10;
area.AxisY.Maximum = 120;
area.AxisY.IsReversed = true;
area.AxisY.Interval = 10;
//area.AxisY.Crossing = double.MaxValue;

//area.AxisX.Minimum = 200;
//area.AxisX.Maximum = 9000;
//area.AxisX.IntervalAutoMode = IntervalAutoMode.VariableCount;

area.AxisX.IsLogarithmic = true;
//area.AxisX.Interval = 250;
area.AxisX.IntervalType = DateTimeIntervalType.Number;
area.AxisX.IntervalOffset = 0;
area.AxisX.IntervalOffsetType = DateTimeIntervalType.Auto;
area.AxisX.LogarithmBase = baseValue;

//area.AxisX.Interval = 1;
//area.AxisX.IsReversed = true;
//area.AxisX.MinorTickMark.Interval = 1;
//area.AxisX.MinorGrid.Interval = 1;
//area.AxisX.MinorGrid.Enabled = true;
//area.AxisX.MinorTickMark.Enabled = true;

//area.AxisX.CustomLabels.Add(0, 250, "250");
//area.AxisX.CustomLabels[0].GridTicks = GridTickTypes.All;

//area.AxisX.CustomLabels.Add(250, 500, "500");
//area.AxisX.CustomLabels[1].GridTicks = GridTickTypes.TickMark;

//area.AxisX.CustomLabels.Add(500, 1000, "1000");
//area.AxisX.CustomLabels[2].GridTicks = GridTickTypes.All;

//area.AxisX.CustomLabels.Add(1000, 2000, "2000");
//area.AxisX.CustomLabels[3].GridTicks = GridTickTypes.TickMark;

//area.AxisX.CustomLabels.Add(2000, 4000, "4000");
//area.AxisX.CustomLabels[4].GridTicks = GridTickTypes.All;

//area.AxisX.CustomLabels.Add(4000, 8000, "8000");
//area.AxisX.CustomLabels[3].GridTicks = GridTickTypes.TickMark;

//area.AxisX.CustomLabels.Add(8000, 16000, "16000");
//area.AxisX.CustomLabels[3].GridTicks = GridTickTypes.All;

Title titleObj = new Title
{
ForeColor = Color.Black,
Text = "Audiometry",
};

if (area.AxisX.IsLogarithmic)
{
titleObj.Text += " logarithmic base " + area.AxisX.LogarithmBase;
}

chart.ChartAreas.Add(area);
chart.Titles.Add(titleObj);

chart.AntiAliasing = AntiAliasingStyles.All;
chart.TextAntiAliasingQuality = TextAntiAliasingQuality.Normal;

//Istanzio un memorystream che sarà utilizzato per la renderizzazione
MemoryStream stream = new MemoryStream();
//Eseguo il salvataggio dell'immagine del grafico nello stream
chart.SaveImage(stream, ChartImageFormat.Png);

//Riporto il cursore all'inizio dello stream
stream.Seek(0, SeekOrigin.Begin);

return stream;
}

QuestionC# crystal report to generate bill/invoice Pin
shashimk8117-Jun-15 21:13
shashimk8117-Jun-15 21:13 
AnswerRe: C# crystal report to generate bill/invoice Pin
joost.versteegen22-Jun-15 1:28
joost.versteegen22-Jun-15 1:28 
QuestionHow do I access checkbox checked value in a email body built using C#? Pin
Rajesh_198017-Jun-15 10:53
Rajesh_198017-Jun-15 10:53 
AnswerRe: How do I access checkbox checked value in a email body built using C#? Pin
rajeshkasani0517-Jun-15 23:41
rajeshkasani0517-Jun-15 23:41 
GeneralRe: How do I access checkbox checked value in a email body built using C#? Pin
Rajesh_198018-Jun-15 4:40
Rajesh_198018-Jun-15 4:40 
GeneralRe: How do I access checkbox checked value in a email body built using C#? Pin
rajeshkasani0521-Jun-15 23:05
rajeshkasani0521-Jun-15 23:05 
GeneralRe: How do I access checkbox checked value in a email body built using C#? Pin
Rajesh_198022-Jun-15 10:41
Rajesh_198022-Jun-15 10:41 
QuestionGeneric problem of VB.NET Pin
econy17-Jun-15 9:12
econy17-Jun-15 9:12 
AnswerRe: Generic problem of VB.NET Pin
Pete O'Hanlon17-Jun-15 9:19
mvePete O'Hanlon17-Jun-15 9:19 
GeneralRe: Generic problem of VB.NET Pin
econy17-Jun-15 9:31
econy17-Jun-15 9:31 
GeneralRe: Generic problem of VB.NET Pin
econy17-Jun-15 9:37
econy17-Jun-15 9:37 
AnswerRe: Generic problem of VB.NET Pin
Kenneth Haugland17-Jun-15 10:01
mvaKenneth Haugland17-Jun-15 10:01 
AnswerRe: Generic problem of VB.NET Pin
Richard MacCutchan17-Jun-15 21:21
mveRichard MacCutchan17-Jun-15 21:21 
QuestionP/Invoce Rename Struct Field Pin
1011001017-Jun-15 4:43
1011001017-Jun-15 4:43 
AnswerRe: P/Invoce Rename Struct Field Pin
PIEBALDconsult17-Jun-15 4:53
mvePIEBALDconsult17-Jun-15 4:53 
AnswerRe: P/Invoce Rename Struct Field Pin
OriginalGriff17-Jun-15 5:13
mveOriginalGriff17-Jun-15 5:13 
SuggestionRe: P/Invoce Rename Struct Field Pin
Richard Deeming17-Jun-15 5:42
mveRichard Deeming17-Jun-15 5:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.