HorizontalAxis or VerticalAxis Brush

Sep 9, 2008 at 8:37 AM
How can I modify the Brush color of HorizontalAxis or VerticalAxis

Thanks
Marco
Developer
Sep 25, 2008 at 4:16 PM
Edited Sep 25, 2008 at 4:18 PM
Unfortunately, there is no way to change brush color in one line of code. Feature request is added and will be available in next release.

In current version you'll need to modify source code:

1. Modify source code of ChartPlotter.cs in following way

 

public class ChartPlotter : Plotter2D {
    ... 

    public
HorizontalAxis HorizontalAxis {   get { return ha; } }
    public VerticalAxis VerticalAxis { get { return va; } }  

 

 

 

}

2. To change brush of axis write following code where you need:

plotter.VerticalAxis.Brush = Brushes.DarkGreen;

plotter.HorizontalAxis.Brush =

Brushes.DarkOrange;

 

plotter.VerticalAxis.InvalidateVisual();

plotter.HorizontalAxis.InvalidateVisual();

 

 

Sep 29, 2008 at 8:49 AM
Thanks for the answer,
another question:
I've a LineGraph with a CirclePointMarker. I need to force an update of the graph. How can I achieve this? It seems that the graph that draws the markers has no relations with the correlated LineGraph. So if I have 20 LineGraph with 20 MarkerGraphs, is there a way to update the render of a specific LineGraph? Making public the Update method of the LineGraph?
And What about related Markers?
Thanks in advance
Developer
Oct 7, 2008 at 3:21 PM
Best way to update line graph is to call RaiseDataChanged on associated data source (see AnimationSample).



// Here it is - signal that data is updated

animatedDataSource.RaiseDataChanged();

 


LineGraph and markers are designed to be linked together. For example, if you change following lines of MainWindow.xaml.cs in AnimationSample

plotter.AddLineGraph(

new CompositeDataSource(xSrc, animatedDataSource),

    new Pen(Brushes.Magenta, 3), 

    new PenDescription("Sin(x + phase)"));



to

 plotter.AddLineGraph( new CompositeDataSource(xSrc, animatedDataSource),

    new Pen(Brushes.Magenta, 3),

    new CirclePointMarker { Size = 10, Brush = Brushes.Red },

    new PenDescription("Sin(x + phase)"));

 



 

you'll see lines and markers moving together.

Can we have a look to your code to understand what is wrong?

 

 

 

 

Oct 9, 2008 at 1:09 PM

I hope you'll enjoy the sample. (I'm thinking about publishing it to codeproject.)

The main questions/requests are:

1. AddLineGraph method overload, when used with markers, returns void, so I can't have a reference of the graph. I think it could be good to have a MarkerPointsGraph property in the LineGraph that references the Markers.

2. I'm adding directly the linegraphs in the plotsurface (myPlotSurface.Viewport.Children.Add(lineGraph1);) to keep the reference of both the markers and the graph, but the FrequencyFilter can't be added due its protection level (eg lineGraph1.Filters.Add(new FrequencyFilter());)

3. Think of adding 10000 points in a loop to a EnumerableDataSource. At this time when each point is added, the graph is forced to render affecting perfomance. It could be very usefull to have a SuspendUpdates and ResumeUpdates methods (in the enumerabledatasource or in the linegraph?) to improve performance.

4. As I've already posted you, I need to have more control on the axis visual.

5. MouseNavigation it's added by default but it should be very usefull to allow the end user to add a custom MouseNavigation

Thanks

Marco Roello

Dec 16, 2009 at 11:13 PM
sberezin wrote:

plotter.HorizontalAxis.Brush = Brushes.DarkOrange;

Hello, this seems not current anymore - the HorizontalAxis class does not expose a Brush member.

I tried setting HorizontalAxis.Foreground, but it only applies to labels, and I'm willing to change the color of the main axis line and ticks.

This package is a great job!

Best regards,

BB

 

Editor
Dec 17, 2009 at 8:47 AM

Hi,

now you should use the following expression to change the color of axis's ticks:

 

((NumericAxis)plotter.MainHorizontalAxis).AxisControl.TicksPath.Stroke = Brushes.OrangeRed;

((NumericAxis)plotter.MainHorizontalAxis).AxisControl.TicksPath.Stroke = Brushes.OrangeRed;

You should replace cast to the relevant class if necessary.

Best regards,

Mikhail.

 

Dec 17, 2009 at 7:10 PM

Thanks, Mikhail!

It works fine for the ticks, though I have plotter.HorizontalAxis, not plotter.MainHorizontalAxis (I'm using 0.3.1 stable from the package dynamicdatadisplay-31108.zip, converted to .NET 4 Beta 2).

How may I change the color of the main axis line?

Best regards,

BB