Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

change color of a diagram element which is stored in the server and retrived as JSON format

Posted on 2016-09-14
4
Medium Priority
?
53 Views
Last Modified: 2016-10-04
{
            "type": "vsm.box",
            "name": "VSM Box",
            "bold": true,
            "italic": true,
            "underline": true,
            "size": {
                "width": 100,
                "height": 100
            },
            "description": "Box",
            "position": {
                "x": 120,
                "y": 290
            },
            "angle": 0,
            "id": "b1b65721-ac0b-4687-a081-88b28109cb9b",
            "embeds": "",
            "z": 1,
            "attrs": {
                "rect": {
                    "stroke": "#000000",
                    "stroke-width": 1,
                    "stroke-dasharray": "0"
                },
                "text": {
                    "text": "Box",
                    "font-family": "Arial",
                    "stroke": "#000000",
                    "stroke-width": 0,
                    "font-weight": 400,
                    "font-style": "normal",
                    "text-decoration": ""
                }
            }
        }

Open in new window

This is one of my program element in JSOn now i would like to fill color to it.
accor ding to rappid api if i change coding it is pushed to
attrs---> rect---->fill:color
0
Comment
Question by:Reek Majumder
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 63

Accepted Solution

by:
Zvonko earned 2000 total points (awarded by participants)
ID: 41799475
Check this:
{
	"type": "vsm.box",
	"name": "VSM Box",
	"bold": true,
	"italic": true,
	"underline": true,
	"size": {
		"width": 100,
		"height": 100
	},
	"description": "Box",
	"position": {
		"x": 120,
		"y": 290
	},
	"angle": 0,
	"id": "b1b65721-ac0b-4687-a081-88b28109cb9b",
	"embeds": "",
	"z": 1,
	"attrs": {
		"rect": {
			"fill":"cornflowerblue",
			"stroke": "#000000",
			"stroke-width": 1,
			"stroke-dasharray": "0"
		},
		"text": {
			"text": "Box",
			"font-family": "Arial",
			"stroke": "#000000",
			"stroke-width": 0,
			"font-weight": 400,
			"font-style": "normal",
			"text-decoration": ""
		}
	}
}

Open in new window

0
 
LVL 63

Expert Comment

by:Zvonko
ID: 41799477
...or the color in hex:
{
	"type": "vsm.box",
	"name": "VSM Box",
	"bold": true,
	"italic": true,
	"underline": true,
	"size": {
		"width": 100,
		"height": 100
	},
	"description": "Box",
	"position": {
		"x": 120,
		"y": 290
	},
	"angle": 0,
	"id": "b1b65721-ac0b-4687-a081-88b28109cb9b",
	"embeds": "",
	"z": 1,
	"attrs": {
		"rect": {
			"fill":"#6495ED",
			"stroke": "#000000",
			"stroke-width": 1,
			"stroke-dasharray": "0"
		},
		"text": {
			"text": "Box",
			"font-family": "Arial",
			"stroke": "#000000",
			"stroke-width": 0,
			"font-weight": 400,
			"font-style": "normal",
			"text-decoration": ""
		}
	}
}

Open in new window

0
 
LVL 34

Expert Comment

by:Slick812
ID: 41799922
greetings Reek Majumder, , It looks like you want to "Change" this fill color in the browser javascript operations that receive the "JSON string" from the server, I guess it uses AJAX to get this "JSON string", it is possible to add the fillcolor property to the rect object in the javascript string, but it may be less difficult to to add the fillcolor property AFTER the "JSON string" is converted to a javascript Object in the code progression. Can you show us the AJAX "JSON string" retrieval  code in the javascript?
0
 
LVL 34

Expert Comment

by:Slick812
ID: 41827710
No comment has been added from the author, so forced closing as abandoned, with best solution presented
0

Featured Post

A new era in Cloud training has arrived.

A day that will go down in Cloud history.. But are you ready for it? Will you accept this Cloud challenge?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
This article discusses how to implement server side field validation and display customized error messages to the client.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…

664 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question