Customizing the appearance of markers in Kendo UI Charts is a great way

I am attempting to customize the markers on a Kendo UI Line chart. The Kendo-Angular bridge I am using can be found here.

I have set up a basic Line chart that pulls data from a JSON file. By utilizing the k-options directive, I am passing in an object with the styles I have created. Everything appears to be functioning correctly except for the series.markers API.

The chart is being created using angular directives:

<div ng-controller="MyCtrl">
    <div class="demo-section k-content">
        <div class="box-col" style="width: 500px;">
            <h4>Hover over some series</h4>
            <div kendo-chart="chart"
                 k-legend="{ position: 'bottom' }"
                 k-series-defaults="{ type: 'line' }"
                 k-series="[
                                 { field: 'id', name: 'ID' },
                                 { field: 'value', name: 'VALUE' }
                             ]"
                 k-data-source="electricity"
                 k-series-hover="onSeriesHover"
                 k-options="chartOptions"
                 ></div>
        </div>
    </div>
</div>

Initialization code:

angular.module("KendoDemos", [ "kendo.directives" ]);
function MyCtrl($scope, $interval) {

    $scope.chartOptions = {
        renderAs: "canvas",
        transitions: false,
        //Widget styling begins
        categoryAxis:{
            background: '#551A8B'
        },
        seriesColors: ["#fa7839"],
        series: {
            markers: {
                type: "triangle",
                size: 30
            }
        }
    }
    $scope.electricity = new kendo.data.DataSource({
        transport: {
            read: {
                url: "electricity.json",
                dataType: "json"
            }
        },
        scheme: {
            model: {
                fields: {
                    Id: { type: "number" },
                    Value: {type: "number"}
                }
            }
        },
        change: function (data) {
            $scope.chart.redraw()
            console.log(data)
            console.log("Changed")
        }
    });
    // Refreshes the graph every 150ms
    $interval(function(){
        $scope.chart.redraw()
        }, 150);


}

This implementation follows the examples provided in the API documentation. The categoryAxis and seriesColors properties are functioning properly, however, the series.markers.type and series.markers.size options do not seem to be taking effect. What could be causing this issue?

Answer №1

If you want to use markers in your series, make sure to specify them for each individual series option as an array, not just as an object. Try explicitly defining the markers inside any objects within the array with series.

For example:

k-series="[
            { field: 'id', name: 'ID',
              markers: {
                 type: 'triangle',
                 size: 30
              } 
             },
            { field: 'value', name: 'VALUE' }
          ]"

Another approach is to place the markers configuration inside seriesDefault.

Additionally, it's important to remember that you need to specify a series type such as "area", "line", "scatter", "scatterLine", "radarLine", "radarArea", "polarLine", "polarScatter" or "polarArea" in order to have markers displayed. By default, the series type is set to 'column'.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Instantiate an model when the AJAX call successfully returns

There is a User model defined as: var UserModel = Backbone.Model.extend({ defaults: { handle: '', email: '', uuid: '', userpic: '', tokenlogin: '' } }); A c ...

AngularJS special filter is not retrieving any data

Having an issue with a new filter that is not receiving data: Here is my error log: Controller Code: angular.module('reklaApp') .controller('MainCtrl', function ($scope, $http, Reklas, Modal) { $scope.newRekla = {}; Reklas.getAll() ...

Reacting to a click event to display a new image

I'm looking to create a webpage with multiple images where clicking on one image will open another image with its description. The images are stored locally in my library. I tried using the href attribute in the html tag, but it doesn't accept lo ...

What is the most efficient schema for managing the position of items in various lists within MongoDB?

When dealing with two collections, lists and items, where each item can belong to multiple lists with a custom position in each list, the question arises: which approach would be more efficient without overcomplicating things? A: Including an array of lis ...

Rendering components based on a condition of a true or false prop value

Here's a code block that I need help with: return ( <StyledActiveOptions className={classNames("lookup-active-options form-control", className)} role="button" tabIndex="0" aria-haspopup=&q ...

How to retrieve the selected text from a specific <span> using JavaScript

Is there a way to extract only the selected text from a specific span element? <span style="font-size:40px">Hi tTheee</span> <span style="font-size:20px">hello</span> <span style="font-size:20px">sdsds </span> Current ...

Utilizing ng-style with a ForEach loop on an Object

How can I dynamically add a new style property to objects in an array in Angular, and then use that property inside ng-style? CommentService.GetComments(12535372).then(function () { $scope.comments = CommentService.data(); angular.forEac ...

Sometimes the last column might not be visible in an HTML table within a collapsed Bootstrap element while using Chrome browser

I've encountered a strange issue when trying to wrap an HTML table inside a collapsing div element using Bootstrap. The last column is not consistently displayed in Chrome (44.0.2403.107 m) depending on the window width, but it works fine in Firefox. ...

Tips for retrieving the element id from a different page using JavaScript

I've been attempting to retrieve an element id from an HTML page on a different page, but none of the solutions I've found have worked so far. For instance, consider the following code snippet from One.html: <input id="a" type="text">< ...

I'm having trouble modifying the style of a different component using Nuxt.js's scoped style

Can someone assist me in understanding how functions? The documentation indicates that it only changes the style within a specific component zone, but what if I need to modify the style of another component based on the current component on the page? For ...

Tips for Comparing and Extracting Values from Two Arrays of Objects

There are two sets of objects that I need to work with: First set of objects ----> [{locationId: 1, locationName: "Bangalore"}, {locationId: 2, locationName: "Mumbai"}] Second set of objects -----> [{baseId: 1, baseUnit: "abc"}, {baseId: 2, b ...

Sequential number matching with regex in Jquery

Recently, I've been working on implementing the keyup function for search after fetching data from a database. After searching through various questions, I found a regex expression for matching numbers in a specific order: Regex for numbers only The ...

Execute the controller function with the value as a parameter

I encountered an issue while attempting to call a function in the c# controller and passing a value. The error message I received was: `'Unable to get property 'then' of undefined or null reference'. I also included the Driver Model but ...

How come my ng-components "select" feature operates in a unique way compared to my HTML5 element?

Can someone help me with using the md-input and md-option elements from the ng-materials ui-components? When I try to use it as an ng-materials object, it doesn't seem to work: <md-input-container> <md-select ng-model="forcast.selectedC ...

Using Angular components to initialize variables within the constructor

My goal is to define a variable within the constructor that will be used to set the path to the C# controller. This variable is named baseUrl. angular.module('adminService', []).factory('adminService', function ($rootScope, $http, $loc ...

Fixing the NodeJS error "TypeError: Crud.Select_products is not a function" is crucial for the proper functioning of your application

I am attempting to access a class that has been exported from the Crud.js file, but I am encountering an error. My objective is to run a sql query. Error: TypeError: Crud.Select_products is not a function at C:\xampp\htdocs\react\c ...

What is the easiest way to simulate a component's method?

My goal is to determine if a component method has been invoked following a store action, but I encountered an error: expect(jest.fn())[.not].toHaveBeenCalled() jest.fn() value must be a mock function or spy. Received: function: [Function bound mockCons ...

What is preventing me from altering the array one element at a time?

I am working with an array and a class let questions = [ { questionText: '', answerOptions: [], }, ]; class Questions { constructor(questionText,answerOptions) { this.questionText = questionText; this.answerOptio ...

Encountering Rendering Issues with EJS Post HTML Conversion

After working on a much larger project for over a month, I'm now six hours into troubleshooting and everything is starting to blend together. Prior to switching to EJS, everything was working perfectly. I'm not looking for someone to solve the ...

What steps can I take to determine the status of my Axios post request?

Here's a simple task I'd like to accomplish using Axios for an Ajax request. When a user clicks on a button, I want to fire an Ajax request. While the request is processing or until it's completed, I would like to disable the button or impl ...