Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
283
Can you use dates as the axis for a linear gauge?
posted

I want to use a gauge to visually represent the percent complete for a project in terms of time. Is this possible?

  • 26458
    Offline posted

    Yes, you can create a scale with a time axis and a marker that takes time values:

    LinearGaugeScale scale = new LinearGaugeScale();
    scale.Axis =
    new TimeAxis(DateTime.Now.AddDays(-1), DateTime.Now.AddDays(1), TimeSpan.FromDays(1));
    scale.Labels.BrushElement = new SolidFillBrushElement(Color.Black);
    LinearGaugeBarMarker marker = new LinearGaugeBarMarker();
    marker.Value =
    DateTime.Now;
    marker.BrushElement =
    new SolidFillBrushElement(Color.Red);
    scale.Markers.Add(marker);

    myGauge.Scales.Add(scale);