Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to not show Grid Lines on Charts #66

Open
amitaypb opened this issue Nov 4, 2022 · 2 comments
Open

Allow to not show Grid Lines on Charts #66

amitaypb opened this issue Nov 4, 2022 · 2 comments

Comments

@amitaypb
Copy link

amitaypb commented Nov 4, 2022

Hello,

I am using your Charts and I would like to have the possibility to be able to hide and show the Grid Lines of Charts.
I was checking your code and when getting the Axes of a Chart, you are setting the axis.ShowGridLines = true (this is done on the protected override void GetAxes(DataPoint firstDataPoint) method)

Can you please add a ShowGridLines dependency Property to the DataPointSingleSeriesWithAxes class and use it on the GetAxes method of each Chart?

For instance:

On DataPointSingleSeriesWithAxes class:

///


/// Gets or sets a value indicating whether grid lines should be shown.
///

[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "GridLines", Justification = "This is the expected casing.")]
public bool ShowGridLines
{
get { return (bool)GetValue(ShowGridLinesProperty); }
set { SetValue(ShowGridLinesProperty, value); }
}

    /// <summary>
    /// Identifies the ShowGridLines dependency property.
    /// </summary>
    [SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "GridLines", Justification = "This is the expected capitalization.")]
    [SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "GridLine", Justification = "This is the expected capitalization.")]
    public static readonly DependencyProperty ShowGridLinesProperty =
        DependencyProperty.Register(
            "ShowGridLines",
            typeof(bool),
            typeof(DataPointSingleSeriesWithAxes),
            new PropertyMetadata(true));

And on ColumnSeries.cs, BarSeries.cs, etc

protected override void GetAxes(DataPoint firstDataPoint)
{
...
if (axis != null)
{
axis.ShowGridLines = ShowGridLines; //Use the value of the Dependency Property
}
...
}

With that, we can do something like (To hide the Grid Lines):
<chartingToolkit:ColumnSeries Grid.Row="0"
Grid.Column="0"
DependentValuePath="Value"
IndependentValuePath="Key"
ItemsSource="{Binding Data}"
ShowGridLines="False"/>

@icehoo
Copy link

icehoo commented Nov 4, 2022 via email

@jogibear9988
Copy link
Member

if you create a pull req for this, i will merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants