New here...

D

DanB

Hi,
This is my forth day doing c#, interesting language. I'm a crusty c++
programmer but we wanted to start using the dundas charts, so...

I seem to be making things work. This is what I have so far:

<http://reserveanalyst.com/images/ChartCtrl.jpg>

That is my app data showing from the same old export we do for excel.
That way I don't have to write a new export and the legacy charts will
still work. Excel charts were always a pain for us so this will be a
nice move.

Best, Dan.
 
A

Arne Vajhøj

This is my forth day doing c#, interesting language. I'm a crusty c++
programmer but we wanted to start using the dundas charts, so...

I seem to be making things work. This is what I have so far:

<http://reserveanalyst.com/images/ChartCtrl.jpg>

That is my app data showing from the same old export we do for excel.
That way I don't have to write a new export and the legacy charts will
still work. Excel charts were always a pain for us so this will be a
nice move.

Welcome to the C# world.

Did you have a question?

Arne
 
D

DanB

Arne said:
Welcome to the C# world.

Did you have a question?

Hi Arne,
Thanks. I've had so many questions I think google will stop letting me
search. But so far, I've been able to muddle through. I fell into this
so fast that I didn't have time to order and read a book.

I've been running with a warning. I needed to copy and compare the
object below so I'm guessing this was the code I needed. If I implement
GetHashCode it will crash XmlSerialize. I just made my best guess as how
to implement.

Best, Dan.

~~~
public class ChartSeriesProp
{
public string name;
public SeriesChartType type;
public int lineWidth;

private Color color;
[XmlElement("lineColor")]
public string str_color// { get; set; }
{
get { return TypeDescriptor.GetConverter(typeof(Color)).ConvertToString(color); }
set { color = (Color) TypeDescriptor.GetConverter(typeof(Color)).ConvertFrom(value); }
}
public Color GetColor( ) { return color; }
public void SetColor( Color inColor ) { color= inColor; }
//
public ChartSeriesProp( )
{
name= "(null)";
type= SeriesChartType.Line;
color= Color.Beige;
lineWidth= 1;
}
}

public class ChartInfoItem
{
public String name;
public bool bXMargins;
public bool bThreeD;
public int tilt3d_x;
public int tilt3d_y;
public ChartSeriesProp [ ]seriesSet;
public int lastTab;

public string tilt3d_xText { get { return tilt3d_x.ToString( ); } }
public string tilt3d_yText { get { return tilt3d_y.ToString( ); } }

public ChartInfoItem( )
{
seriesSet= new ChartSeriesProp[ 3 ];
for( int i= 0; i < 3; ++i )
seriesSet[ i ]= new ChartSeriesProp( );
}

public ChartInfoItem Clone( )
{
ChartInfoItem newItem= new ChartInfoItem( );
newItem.AssignValue( this );
newItem.AssignState( this );
return newItem;
}

public override bool Equals( System.Object obj )
{
// If parameter is null return false.
if( obj == null )
{
return false;
}

// If parameter cannot be cast to Point return false.
ChartInfoItem p = obj as ChartInfoItem;
if( (System.Object)p == null )
{
return false;
}

// Return true if the fields match:
int i= 0;
for( ; i < 3; ++i )
{
if( ( seriesSet[ i ].name == p.seriesSet[ i ].name )
&& ( seriesSet[ i ].type == p.seriesSet[ i ].type )
&& ( seriesSet[ i ].lineWidth == p.seriesSet[ i ].lineWidth )
&& ( seriesSet[ i ].GetColor( ) == p.seriesSet[ i ].GetColor( ) ) )
continue;
break;
}
if( i != 3 )
return false;

return (name == p.name)
&& (bThreeD == p.bThreeD)
&& (tilt3d_x == p.tilt3d_x)
&& (tilt3d_y == p.tilt3d_y)
&& (bXMargins == p.bXMargins);
}

public bool Equals( ChartInfoItem p )
{
// If parameter is null return false:
if( (object)p == null )
{
return false;
}
// Return true if the fields match:
int i= 0;
for( ; i < 3; ++i )
{
if( ( seriesSet[ i ].name == p.seriesSet[ i ].name )
&& ( seriesSet[ i ].type == p.seriesSet[ i ].type )
&& ( seriesSet[ i ].lineWidth == p.seriesSet[ i ].lineWidth )
&& ( seriesSet[ i ].GetColor( ) == p.seriesSet[ i ].GetColor( ) ) )
continue;
break;
}
if( i != 3 )
return false;

return (name == p.name)
&& (bThreeD == p.bThreeD)
&& (tilt3d_x == p.tilt3d_x)
&& (tilt3d_y == p.tilt3d_y)
&& (bXMargins == p.bXMargins);
}

public void AssignValue( ChartInfoItem p )
{
for( int i= 0; i < 3; ++i )
{
seriesSet[ i ].name= p.seriesSet[ i ].name;
seriesSet[ i ].type= p.seriesSet[ i ].type;
seriesSet[ i ].lineWidth= p.seriesSet[ i ].lineWidth;
seriesSet[ i ].SetColor( p.seriesSet[ i ].GetColor( ) );
}
name= p.name;
bThreeD= p.bThreeD;
bXMargins= p.bXMargins;
tilt3d_x= p.tilt3d_x;
tilt3d_y= p.tilt3d_y;
lastTab= p.lastTab;
}

public void AssignState( ChartInfoItem p )
{
lastTab= p.lastTab;
}

/* public override int GetHashCode( )
{
return name.GetHashCode( ) ^ (int)type ^ ( bXMargins ? 1 : 0 );
}
*/ }
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top