I want to paint my time axis like this:
Or just highlight last week, day, hour.
Is there way to apply style only on part of axis?
- Denis Denis asked 6 years ago
- You must login to post comments
I’ve done something. Share it here.
public partial class RulerAnnotation : CompositeAnnotation {
private new const float Height = 0.003f;
private const int Count = 24 / 3;
private static readonly TimeSpan Duration = new TimeSpan( 24, 0, 0 ); // 24 hours
private static readonly Brush[] Brushes = new Brush[Count] {
new SolidColorBrush( Color.FromRgb(63 * 1, 0, 0) ),
new SolidColorBrush( Color.FromRgb(63 * 2, 0, 0) ),
new SolidColorBrush( Color.FromRgb(63 * 3, 0, 0) ),
new SolidColorBrush( Color.FromRgb(63 * 4, 0, 0) ),
new SolidColorBrush( Color.FromRgb(0, 63 * 1, 0) ),
new SolidColorBrush( Color.FromRgb(0, 63 * 2, 0) ),
new SolidColorBrush( Color.FromRgb(0, 63 * 3, 0) ),
new SolidColorBrush( Color.FromRgb(0, 63 * 4, 0) ),
};
public RulerAnnotation() {
InitializeComponent();
this.Loaded += OnLoaded;
}
private void OnLoaded(object sender, RoutedEventArgs routedEventArgs) {
if (DesignerProperties.GetIsInDesignMode( this )) return;
var max = (DateTime) XAxis.DataRange.Max;
var time = max.AddHours( -max.Hour ).AddMinutes( -max.Minute ).AddSeconds( -max.Second );
CoordinateMode = AnnotationCoordinateMode.RelativeY;
X1 = time;
X2 = time.Add( Duration );
Y1 = 1 - Height;
Y2 = 1f;
foreach (var item in GetBoxes()) {
Annotations.Add( item );
}
}
private static IEnumerable<BoxAnnotation> GetBoxes() {
for (int i = 0; i < Count; i++) {
yield return new BoxAnnotation() {
Background = Brushes[i],
CoordinateMode = AnnotationCoordinateMode.Relative,
X1 = (float) i / Count,
X2 = (float) (i + 1) / Count,
Y1 = 0,
Y2 = 1
};
}
}
}
- Denis Denis answered 6 years ago
- last edited 6 years ago
- You must login to post comments
I am considering applying server-side licensing for my javerScript application.
In the document below, there is a phrase “Our server-side licensing component is written in C++.”
(https://support-dev.scichart.com/index.php?/Knowledgebase/Article/View/17256/42/)
However, there is only asp.net sample code on the provided github.
(https://github.com/ABTSoftware/SciChart.JS.Examples/tree/master/Sandbox/demo-dotnet-server-licensing)
I wonder if there is a sample code implemented in C++ for server-side licensing.
Can you provide c++ sample code?
Also, are there any examples to run on Ubuntu?
- Andrew Burnett-Thompson answered 6 years ago
-
I want to paint even/odd days on time axis in yellow/black colors.
- You must login to post comments
I’m afraid what you want to do is not possible without a source-code license, or without deep customisation of axis templates.
In the axis class we have three methods for drawing.
- AxisBase.OnDraw(IRenderContext2D renderContext, IRenderPassData renderPassData)
- AxisBase.DrawGridLines(IRenderContext2D renderContext, Style gridLineStyle, IEnumerable coordsToDraw)
- AxisBase.DrawBands(IRenderContext2D renderContext, double[] ticks, float[] ticksCoords)
These draw the gridlines and the bands on the main render surface itself, so the RenderContext is the same one shared with the chart.
The ticks are drawn on the axis itself. In AxisPanel.DrawTicks. This is where we create a Rendercontext and draw ticks on the axis.
So the only way to do this is to either modify the source code for AxisPanel.DrawTicks, or substitute your own class for AxisPanel in the template for the axis and to modify how it draws ticks. Either way doing this without a source-code license will be very difficult.
Sorry I can’t be more help,
Best regards,
Andrew
- Andrew Burnett-Thompson answered 6 years ago
-
Bad. I’m always misunderstanding what the period of time I watch. But I can paint it on chart surface. Just add translucent column chart. It’s better than nothing.
-
Yes, good idea. It’s much easier to paint it on the chart with custom series, or annotations
- You must login to post comments
Ok, I added a few box annotations on chart surface. And I want my boxes to be between background and series. So, I used AnnotationCanvas.BelowChart.
And I see something not good https://youtu.be/PlORkhwW69A ?
Is it ok?
Also, can I use AnnotationCanvas.XAxis to paint annotations on time axis?
Now if I use AnnotationCanvas.XAxis then I can’t see my annotations.
- Denis Denis answered 6 years ago
-
Hi Denis, the annotations are appearing below the Axis Bands. If you set Axis.DrawMajorBands = false they will appear correctly.
-
I still don’t lose hope. What is ModifierAxisCanvas? Can I use it to draw on time axis? Are there examples with ModifierAxisCanvas? Or as you said without sources I can’t do it?
- You must login to post comments
Please login first to submit.